On Thu, 2007-09-06 at 23:57 +1000, Nigel Tao wrote:
> I have two GTK programs (i.e. two separate processes), S and P, and I
> want a GtkSocket running in S to hold a GtkPlug running in P.  I've
> followed the docs, and that's straightforward to get working.
> 
> Now, in S, the GtkSocket actually lives in one GtkVBox, and after the
> GtkSocket and GtkPlug have found each other, I would like to move it
> to another GtkVBox, e.g. in response to a button click.  I write code
> like:
>   gtk_container_remove (GTK_CONTAINER (vbox1), socket);
>   gtk_container_add (GTK_CONTAINER (vbox2), socket);
> since that's how I move a GtkLabel from one vbox to another.
> 
> However, the removal causes the GtkSocket to unrealize itself (IIUC),
> which makes the GtkPlug reparent to the root window, which triggers a
> delete-event on the GtkPlug.  Thus, when I re-add the GtkSocket to the
> second GtkVBox, it is empty.

You should be able to keep the socket alive by incrementing the
reference count before removing it, and decrementing it again after
adding it in the new container.

Chris


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to