Re: how to replace a child of a GtkBox ?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan H wrote:
On Sun, 30 Dec 2007 23:35:02 +0200
"Zeeshan Ali Khattak" <zeenix gstreamer net> wrote:

Hi Gregory!

        - How do I remove the old object from the GtkBox ?

        - How do I "free up" the old object (image/pixbuf) ? Do I
          simply unref it ?
   You don't have to do any of these. As a general rule of thumb in
the gobject world, each object keeps it's own reference of the
objects it needs. So when you set a new child on a GtkBox object,
the GtkBox must unref the old child widget.

But don't you still first have to remove the old child?


What I ended up doing...

I ended up destroying the old child (gtk_widget_destroy(child)) which removes
the child from the container, and destroys it.

I then add a new child to the box (gtk_box_pack_start()), and then reordered the
child to it's rightful place.

And the way I managed the child, is with a g_object_set_data() to store it's
address, for accessibility (which brings up another concern, but that's the
subject of another thread :)

Thank you all!

- -Greg

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


- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFHeMK9404fl/0CV/QRAkdPAJ4qQaCOo5Rm6/gx9z4N41uLNODKcACgxYVB
m0xEr+Q7A4HzZ4RYfudcGKE=
=uVon
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]