aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk/genericmenuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2009-12-17 15:49:27 -0600
committerTed Gould <ted@gould.cx>2009-12-17 15:49:27 -0600
commit21b5c268ced2ded5ffe46be7f718e186eb2c834c (patch)
tree8994dcf2f23ce2e8403b69f2c658f99411745d6d /libdbusmenu-gtk/genericmenuitem.c
parentc300f8c5be570efbf14792dcee496db8d957154e (diff)
downloadlibdbusmenu-21b5c268ced2ded5ffe46be7f718e186eb2c834c.tar.gz
libdbusmenu-21b5c268ced2ded5ffe46be7f718e186eb2c834c.tar.bz2
libdbusmenu-21b5c268ced2ded5ffe46be7f718e186eb2c834c.zip
Handling the case of getting an image with the purpose of clearing the label. Also showing the image.
Diffstat (limited to 'libdbusmenu-gtk/genericmenuitem.c')
-rw-r--r--libdbusmenu-gtk/genericmenuitem.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c
index dded1de..f927556 100644
--- a/libdbusmenu-gtk/genericmenuitem.c
+++ b/libdbusmenu-gtk/genericmenuitem.c
@@ -376,7 +376,7 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)
} else if (GTK_IS_BOX(child)) {
/* Look for the label in the box */
gtk_container_foreach(GTK_CONTAINER(child), set_image_helper, &imagew);
- } else {
+ } else if (image != NULL) {
/* We need to put the child into a new box and
make the box the child of the menu item. Basically
we're inserting a box in the middle. */
@@ -401,10 +401,14 @@ genericmenuitem_set_image (Genericmenuitem * menu_item, GtkWidget * image)
/* Check to see if it needs to be in the bin for this
menu item or whether it gets packed in a box. */
- if (child == NULL) {
- gtk_container_add(GTK_CONTAINER(menu_item), GTK_WIDGET(image));
- } else {
- gtk_box_pack_start(GTK_BOX(child), GTK_WIDGET(image), FALSE, FALSE, 0);
+ if (image != NULL) {
+ if (child == NULL) {
+ gtk_container_add(GTK_CONTAINER(menu_item), GTK_WIDGET(image));
+ } else {
+ gtk_box_pack_start(GTK_BOX(child), GTK_WIDGET(image), FALSE, FALSE, 0);
+ }
+
+ gtk_widget_show(image);
}
return;