From 76cf0520badaf94b7137e19dfbd9c4ea61940c4e Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 13 Oct 2011 00:36:19 +0000 Subject: [PATCH] (trunk gtk) #4553 "Set about dialog to modal when compiled with GTK+-3" -- fix About dialog issue when hiding and then re-showing Transmission. --- gtk/util.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 ); }