From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Anthony Liguori <aliguori@amazon.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] gtk: avoid gd_widget_reparent with gtk 3.14+
Date: Thu, 23 Oct 2014 18:34:33 +0200 [thread overview]
Message-ID: <1414082073-31084-1-git-send-email-kraxel@redhat.com> (raw)
gtk_widget_reparent is depricated in gtk 3.14, stop using it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
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);
--
1.8.3.1
next reply other threads:[~2014-10-23 16:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-23 16:34 Gerd Hoffmann [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-10-23 16:33 [Qemu-devel] [PATCH] gtk: avoid gd_widget_reparent with gtk 3.14+ Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414082073-31084-1-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@amazon.com \
--cc=dgilbert@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).