Modifying the text of a single item in a menu.



I have spent the last few hours trying to work out how to modify the
text of an item in a menu.  I have as yet been unsuccessful.

All of the items in the menu were created with gtk_menu_item_new_with_label()

The code I am using to traverse and update the menu looks like:

    for (list = GTK_MENU_SHELL(menu)->children; list != NULL;
	 list = list->next) {
	GtkBin* bin = GTK_BIN(list->data);
	if (bin->child != NULL) {
	    char* text;
	    gtk_label_get(GTK_LABEL(bin->child), &text);
	    if (strcmp(text, current) == 0) {
		gtk_label_set(GTK_LABEL(bin->child), new);
		break;
	    }
	}
    }

For some reason which I cannot understand, the bin never has a
non-null child in it.  I am obviously missing something here, I just
cannot work out what it is.

- Dave

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS dpu s-:+ a C++$ ULS++$ P+++$>++++ L++>+++$ E+>++ W N++ !o K w++$ O !M-
!V(-) PS+ PE- Y+ PGP !t-- 5++ X R tv b+ DI+++ D G e++ h--- r+++ y++++
------END GEEK CODE BLOCK------



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