Re: how to replace a child of a GtkBox ?



gtk_notebook_get_tab_label() will get the widget. That will give you the reference to your GtkHBox. You can then get the pointer to the GtkImage (assuming image is first child) from the children GList of the GtkBox. Just off my head, maybe something like...

GtkWidget *box, *image;

box = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook));
image = GTK_WIDGET (g_list_first(box->children)->data); gtk_image_set_from_file (GTK_IMAGE (image), "new-image.png");

- Micah Carrick

 Developer - http://www.micahcarrick.com
 GTK+ Forums - http://www.gtkforums.com



Gregory Hosler wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

I have a GtkNotebook, and for my tab's I built a GtkBox, with 2 children. a
GtkImage image, and a label.

Now I wish to update the GtkImage, either with another GtkImage, or replace it
with a GtkPixbuf (depending upon, well, stuff...)

My question(s):

        - 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 ?

        - Is there an easier way to replace one child (of the GtkBox)
          with another object ? (as opposed to removing the old object
          and adding a new object).

        - Since I'm replacing the FIRST object in the box, I assume that once
          I add the new object I will have to gtk_box_reorder_child() it to put
          it in the position I want, yes?

Any thoughts, comments appreciated.

Best rgds,

- -Greg Hosler

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

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)

iD8DBQFHd1ro404fl/0CV/QRAiBKAJ49Rt2GjkEs2A4ZBPKPFNix+9tsjQCfSmJk
uHrh0O37e5z6nvfzIkVv0xA=
=mQQi
-----END PGP SIGNATURE-----
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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