popupMenu: Fix setting ImageMenuItem's icons via strings

Commit 28ca96064b added support for setting PopupImageMenuItem's icons
via GIcons as well as via strings. However as the check whether an object
implements the GIcon interface only works on GObjects, specifying an icon
name was broken. Fix that to actually allow both strings and GIcons.

https://bugzilla.gnome.org/show_bug.cgi?id=789018
This commit is contained in:
Florian Müllner 2017-10-16 00:09:52 +02:00
parent 40616015e5
commit f4237a4ae7

View File

@ -405,7 +405,7 @@ var PopupImageMenuItem = new Lang.Class({
setIcon: function(icon) { setIcon: function(icon) {
// The 'icon' parameter can be either a Gio.Icon or a string. // The 'icon' parameter can be either a Gio.Icon or a string.
if (GObject.type_is_a(icon, Gio.Icon)) if (icon instanceof GObject.Object && GObject.type_is_a(icon, Gio.Icon))
this._icon.gicon = icon; this._icon.gicon = icon;
else else
this._icon.icon_name = icon; this._icon.icon_name = icon;