Practically you have to call g_menu_item_set_attribute (menuitem, "x-canonical-type", "s", "ImSourceMenuItem"); in case if icon is null.
Practically you have to call item_set_ attribute (menuitem, "x-canonical-type", "s", "ImSourceMenuIt em");
g_menu_
in case if icon is null.