diff --git a/gtk/util.c b/gtk/util.c index df114ba22..7ca3d5967 100644 --- a/gtk/util.c +++ b/gtk/util.c @@ -493,6 +493,8 @@ gtr_vbox_new( gboolean homogenous UNUSED, gint spacing ) #endif } +#define GTR_CHILD_HIDDEN "gtr-child-hidden" + void gtr_widget_set_visible( GtkWidget * w, gboolean b ) { @@ -504,9 +506,25 @@ gtr_widget_set_visible( GtkWidget * w, gboolean b ) GtkWindow * window = GTK_WINDOW( w ); for( l=windows; l!=NULL; l=l->next ) - if( GTK_IS_WINDOW( l->data ) ) - if( gtk_window_get_transient_for( GTK_WINDOW( l->data ) ) == window ) - gtr_widget_set_visible( GTK_WIDGET( l->data ), b ); + { + if( !GTK_IS_WINDOW( l->data ) ) + continue; + if( gtk_window_get_transient_for( GTK_WINDOW( l->data ) ) != window ) + continue; + if( gtk_widget_get_visible( GTK_WIDGET( l->data ) ) == b ) + continue; + + if( b && g_object_get_data( G_OBJECT( l->data ), GTR_CHILD_HIDDEN ) != NULL ) + { + g_object_steal_data( G_OBJECT( l->data ), GTR_CHILD_HIDDEN ); + gtr_widget_set_visible( GTK_WIDGET( l->data ), TRUE ); + } + else if( !b ) + { + g_object_set_data( G_OBJECT( l->data ), GTR_CHILD_HIDDEN, GINT_TO_POINTER( 1 ) ); + gtr_widget_set_visible( GTK_WIDGET( l->data ), FALSE ); + } + } g_list_free( windows ); }