From 1a4e5a981b4605cd32e132128076e38e2aa9b8bc Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 22 Oct 2017 18:29:31 +1030 Subject: [PATCH] glib demo: correct the previous warnings fix Bug 103050 --- glib/demo/utils.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/glib/demo/utils.c b/glib/demo/utils.c index ad9405aa..aa6cd761 100644 --- a/glib/demo/utils.c +++ b/glib/demo/utils.c @@ -275,8 +275,11 @@ pgd_action_view_play_rendition (GtkWidget *button, g_object_unref (file); if (uri) { #if GTK_CHECK_VERSION(3, 22, 0) - gtk_show_uri_on_window (GTK_WINDOW(gtk_widget_get_window (button)), - uri, GDK_CURRENT_TIME, NULL); + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (button); + gtk_show_uri_on_window (gtk_widget_is_toplevel (toplevel) ? GTK_WINDOW (toplevel) : NULL, + uri, GDK_CURRENT_TIME, NULL); #else gtk_show_uri (gtk_widget_get_screen (button), uri, GDK_CURRENT_TIME, NULL); @@ -543,13 +546,16 @@ pgd_movie_view_play_movie (GtkWidget *button, g_object_unref (file); if (uri) { #if GTK_CHECK_VERSION(3, 22, 0) - gtk_show_uri_on_window (GTK_WINDOW(gtk_widget_get_window (button)), - uri, GDK_CURRENT_TIME, NULL); + GtkWidget *toplevel; + + toplevel = gtk_widget_get_toplevel (button); + gtk_show_uri_on_window (gtk_widget_is_toplevel (toplevel) ? GTK_WINDOW (toplevel) : NULL, + uri, GDK_CURRENT_TIME, NULL); #else - gtk_show_uri (gtk_widget_get_screen (button), - uri, GDK_CURRENT_TIME, NULL); + gtk_show_uri (gtk_widget_get_screen (button), + uri, GDK_CURRENT_TIME, NULL); #endif - g_free (uri); + g_free (uri); } } -- 2.11.0