From 21f122161e551b286af4537a59f20d46b824e383 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 14 Apr 2015 12:41:25 -0400 Subject: [PATCH] More of the last few commits, now on the GTK+ backend. THAT ONE WORKS... --- new/newcontrol_unix.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/new/newcontrol_unix.c b/new/newcontrol_unix.c index 221548c..500798b 100644 --- a/new/newcontrol_unix.c +++ b/new/newcontrol_unix.c @@ -29,23 +29,20 @@ static uintptr_t singleHandle(uiControl *c) } static void singleSetParent(uiControl *c, uiParent *parent) -{ - singleWidget *s = (singleWidget *) (c->internal); - - s->parent = parent; - gtk_container_add(GTK_CONTAINER(uiParentHandle(s->parent)), s->immediate); - uiParentUpdate(s->parent); -} - -static void singleRemoveParent(uiControl *c) { singleWidget *s = (singleWidget *) (c->internal); uiParent *oldparent; oldparent = s->parent; - s->parent = NULL; - gtk_container_remove(GTK_CONTAINER(oldparent), s->immediate); - uiParentUpdate(oldparent); + s->parent = parent; + if (oldparent != NULL) { + gtk_container_remove(GTK_CONTAINER(uiParentHandle(oldparent)), s->immediate); + uiParentUpdate(oldparent); + } + if (s->parent != NULL) { + gtk_container_add(GTK_CONTAINER(uiParentHandle(s->parent)), s->immediate); + uiParentUpdate(s->parent); + } } static void singlePreferredSize(uiControl *c, uiSizing *d, intmax_t *width, intmax_t *height) @@ -209,7 +206,6 @@ uiControl *uiUnixNewControl(GType type, gboolean inScrolledWindow, gboolean scro c->destroy = singleDestroy; c->handle = singleHandle; c->setParent = singleSetParent; - c->removeParent = singleRemoveParent; c->preferredSize = singlePreferredSize; c->resize = singleResize; c->visible = singleVisible;