From patchwork Thu Oct 23 16:34:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 402594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 984A414003E for ; Fri, 24 Oct 2014 03:35:46 +1100 (AEDT) Received: from localhost ([::1]:42084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhLMW-0004S1-HO for incoming@patchwork.ozlabs.org; Thu, 23 Oct 2014 12:35:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhLLY-0002vV-UB for qemu-devel@nongnu.org; Thu, 23 Oct 2014 12:34:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhLLS-0007ay-Q0 for qemu-devel@nongnu.org; Thu, 23 Oct 2014 12:34:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhLLS-0007al-HG for qemu-devel@nongnu.org; Thu, 23 Oct 2014 12:34:38 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9NGYbcg020540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 23 Oct 2014 12:34:37 -0400 Received: from nilsson.home.kraxel.org (ovpn-116-41.ams2.redhat.com [10.36.116.41]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9NGYa36009148; Thu, 23 Oct 2014 12:34:36 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id D96B180E01; Thu, 23 Oct 2014 18:34:35 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 23 Oct 2014 18:34:33 +0200 Message-Id: <1414082073-31084-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , "Dr. David Alan Gilbert" , Anthony Liguori , Gerd Hoffmann Subject: [Qemu-devel] [PATCH] gtk: avoid gd_widget_reparent with gtk 3.14+ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org gtk_widget_reparent is depricated in gtk 3.14, stop using it. Signed-off-by: Gerd Hoffmann --- Notes: v2: - use g_object_ref instead of gtk_widget_ref, drop ifdefs ui/gtk.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 5249820..5fecf27 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -437,6 +437,15 @@ static void gtk_release_modifiers(GtkDisplayState *s) } } +static void gd_widget_reparent(GtkWidget *from, GtkWidget *to, + GtkWidget *widget) +{ + g_object_ref(G_OBJECT(widget)); + gtk_container_remove(GTK_CONTAINER(from), widget); + gtk_container_add(GTK_CONTAINER(to), widget); + g_object_unref(G_OBJECT(widget)); +} + /** DisplayState Callbacks **/ static void gd_update(DisplayChangeListener *dcl, @@ -1054,7 +1063,7 @@ static gboolean gd_tab_window_close(GtkWidget *widget, GdkEvent *event, GtkDisplayState *s = vc->s; gtk_widget_set_sensitive(vc->menu_item, true); - gtk_widget_reparent(vc->tab_item, s->notebook); + gd_widget_reparent(vc->window, s->notebook, vc->tab_item); gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(s->notebook), vc->tab_item, vc->label); gtk_widget_destroy(vc->window); @@ -1089,7 +1098,7 @@ static void gd_menu_untabify(GtkMenuItem *item, void *opaque) if (!vc->window) { gtk_widget_set_sensitive(vc->menu_item, false); vc->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_reparent(vc->tab_item, vc->window); + gd_widget_reparent(s->notebook, vc->window, vc->tab_item); g_signal_connect(vc->window, "delete-event", G_CALLBACK(gd_tab_window_close), vc);