From 21b5c268ced2ded5ffe46be7f718e186eb2c834c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 17 Dec 2009 15:49:27 -0600 Subject: Handling the case of getting an image with the purpose of clearing the label. Also showing the image. --- libdbusmenu-gtk/genericmenuitem.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-gtk/genericmenuitem.c') 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; -- cgit v1.2.3