After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 317520 - gtk_image_new/set_from_gtk_image
gtk_image_new/set_from_gtk_image
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Widget: Other
2.8.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-09-29 14:01 UTC by Paolo Borelli
Modified: 2014-01-25 02:37 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Paolo Borelli 2005-09-29 14:01:31 UTC
There is currently no reliable way to "clone" a generic GtkImage.

Suppose you have a composite widget with two images that must stay in sync and
you have a set_image(GtkImage) method: you need a way to build another copy of
the image since the same widget cannot be packed in two containers.

All you have now is

switch (gtk_image_get_storage_type(image))
{
   case foo: gtk_image_new_from_foo;
   case bar: gtk_image_new_from_bar;
...
}

Which not only sucks, but it is also not robust to the addition of new stoarge
types.
Comment 1 Owen Taylor 2005-09-30 02:57:18 UTC
It's quite unclear to me what the use case is here.
Comment 2 Paolo Borelli 2005-09-30 06:45:28 UTC
the use case is the following: I have a widget that which contains a notebook
and a title; each page of the notebook contains an image and a name on its label
and the title contains the image and the name of the current page; pages can be
added dinamically by plugin. When a plugin uses my .set_image() method to set a
GtkImage on its page label, I also need to make an exact copy of the GtkImage in
order to display it in the title.

There is no reliable way to set the image in the title starting from the image
passed to set_image. I'm currently using the above 'switch', but that it's going
to break if/when a new storage_method is added.