Icon in GMenuItem in Gtk3

I created a GMenu with several GMenuItems, and shown it using Gtk.Popover. The odd thing is that two of the items have icons, but they aren’t shown. Is there something that I have to do to show them, other than setting the icon in the item?

The code where I create the menu is this:

  var item = new GLib.MenuItem(text, null);
  item.set_action_and_target_value(action, new Variant.int32(this.pid));

  if (icon != null) {
    var gicon = new GLib.FileIcon(File.new_for_uri("resource://"+icon));
    item.set_icon(gicon);
  }
  menu.append_item(item);

No, icons are not visible in menus, unless you use the verb-icon item attribute, in which case the menu item becomes an iconic item, i.e. icon-only.

1 Like