(trunk gtk) #4553 "Set about dialog to modal when compiled with GTK+-3" -- fix About dialog issue when hiding and then re-showing Transmission.

This commit is contained in:
Jordan Lee 2011-10-13 00:36:19 +00:00
parent 75767317ad
commit 76cf0520ba
1 changed files with 21 additions and 3 deletions

View File

@ -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 );
}