Add symbolic icons to TextureCache's load_icon_name()
Icons can be loaded as St.Icon.SYMBOLIC, FULLCOLOR, APPLICATION or DOCUMENT. The first will look for a symbolic equivalent, the second looks for a full-color version (and does fallback, eg, from "drive-harddisk-usb" to "drive-harddisk"). APPLICATION and DOCUMENT do full-color icons without fallback (as specified by the icon spec). And update various callers to use the right flags. Based on a patch from Matt Novenstern. https://bugzilla.gnome.org/show_bug.cgi?id=621311
This commit is contained in:
@ -678,8 +678,9 @@ LookingGlass.prototype = {
|
||||
|
||||
let toolbar = new St.BoxLayout({ name: 'Toolbar' });
|
||||
this.actor.add_actor(toolbar);
|
||||
let inspectIcon = St.TextureCache.get_default().load_gicon(new Gio.ThemedIcon({ name: 'gtk-color-picker' }),
|
||||
24);
|
||||
let inspectIcon = St.TextureCache.get_default().load_icon_name('gtk-color-picker',
|
||||
St.IconType.SYMBOLIC,
|
||||
24);
|
||||
toolbar.add_actor(inspectIcon);
|
||||
inspectIcon.reactive = true;
|
||||
inspectIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||
|
@ -346,7 +346,7 @@ Notification.prototype = {
|
||||
|
||||
if (Gtk.IconTheme.get_default().has_icon(id)) {
|
||||
button.add_style_class_name('notification-icon-button');
|
||||
button.child = St.TextureCache.get_default().load_icon_name(id, BUTTON_ICON_SIZE);
|
||||
button.child = St.TextureCache.get_default().load_icon_name(id, St.IconType.SYMBOLIC, BUTTON_ICON_SIZE);
|
||||
} else {
|
||||
button.add_style_class_name('notification-button');
|
||||
button.label = label;
|
||||
|
@ -148,7 +148,7 @@ NotificationDaemon.prototype = {
|
||||
let uri = GLib.filename_to_uri(icon, null);
|
||||
return textureCache.load_uri_async(uri, size, size);
|
||||
} else
|
||||
return textureCache.load_icon_name(icon, size);
|
||||
return textureCache.load_icon_name(icon, St.IconType.FULLCOLOR, size);
|
||||
} else if (hints.icon_data) {
|
||||
let [width, height, rowStride, hasAlpha,
|
||||
bitsPerSample, nChannels, data] = hints.icon_data;
|
||||
@ -165,7 +165,7 @@ NotificationDaemon.prototype = {
|
||||
stockIcon = 'gtk-dialog-error';
|
||||
break;
|
||||
}
|
||||
return textureCache.load_icon_name(stockIcon, size);
|
||||
return textureCache.load_icon_name(stockIcon, St.IconType.FULLCOLOR, size);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -61,7 +61,7 @@ SystemStatusButton.prototype = {
|
||||
this._iconName = iconName;
|
||||
if (this._iconActor)
|
||||
this._iconActor.destroy();
|
||||
this._iconActor = St.TextureCache.get_default().load_icon_name(this._iconName, 24);
|
||||
this._iconActor = St.TextureCache.get_default().load_icon_name(this._iconName, St.IconType.SYMBOLIC, 24);
|
||||
this.actor.set_child(this._iconActor);
|
||||
},
|
||||
|
||||
|
@ -158,7 +158,7 @@ PlacesManager.prototype = {
|
||||
|
||||
this._connect = new PlaceInfo('special:connect', _("Connect to..."),
|
||||
function (size) {
|
||||
return St.TextureCache.get_default().load_icon_name('applications-internet', size);
|
||||
return St.TextureCache.get_default().load_icon_name('applications-internet', St.IconType.FULLCOLOR, size);
|
||||
},
|
||||
function () {
|
||||
new Shell.Process({ args: ['nautilus-connect-server'] }).run();
|
||||
@ -432,7 +432,7 @@ DashPlaceDisplayItem.prototype = {
|
||||
box.add(text, { expand: true, x_fill: true });
|
||||
|
||||
if (info.isRemovable()) {
|
||||
let removeIcon = St.TextureCache.get_default().load_icon_name ('media-eject', PLACES_ICON_SIZE);
|
||||
let removeIcon = St.TextureCache.get_default().load_icon_name ('media-eject', St.IconType.FULLCOLOR, PLACES_ICON_SIZE);
|
||||
let removeIconBox = new St.Clickable({ child: removeIcon,
|
||||
reactive: true });
|
||||
box.add(removeIconBox);
|
||||
|
@ -252,7 +252,7 @@ PopupImageMenuItem.prototype = {
|
||||
if (!show) {
|
||||
this._imageBin.hide();
|
||||
} else {
|
||||
let img = St.TextureCache.get_default().load_icon_name(this._iconName, this._size);
|
||||
let img = St.TextureCache.get_default().load_icon_name(this._iconName, St.IconType.SYMBOLIC, this._size);
|
||||
this._imageBin.set_child(img);
|
||||
this._imageBin.show();
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ StatusMenuButton.prototype = {
|
||||
box.add(this._iconBox, { y_align: St.Align.MIDDLE, y_fill: false });
|
||||
|
||||
let textureCache = St.TextureCache.get_default();
|
||||
this._availableIcon = textureCache.load_icon_name('user-available', 16);
|
||||
this._busyIcon = textureCache.load_icon_name('user-busy', 16);
|
||||
this._invisibleIcon = textureCache.load_icon_name('user-invisible', 16);
|
||||
this._idleIcon = textureCache.load_icon_name('user-idle', 16);
|
||||
this._availableIcon = textureCache.load_icon_name('user-available', St.IconType.SYMBOLIC, 16);
|
||||
this._busyIcon = textureCache.load_icon_name('user-busy', St.IconType.SYMBOLIC, 16);
|
||||
this._invisibleIcon = textureCache.load_icon_name('user-invisible', St.IconType.SYMBOLIC, 16);
|
||||
this._idleIcon = textureCache.load_icon_name('user-idle', St.IconType.SYMBOLIC, 16);
|
||||
|
||||
this._presence.connect('StatusChanged', Lang.bind(this, this._updatePresenceIcon));
|
||||
this._presence.getStatus(Lang.bind(this, this._updatePresenceIcon));
|
||||
|
@ -347,7 +347,7 @@ ContactManager.prototype = {
|
||||
let uri = GLib.filename_to_uri(file, null);
|
||||
iconBox.child = textureCache.load_uri_async(uri, iconBox._size, iconBox._size);
|
||||
} else {
|
||||
iconBox.child = textureCache.load_icon_name('stock_person', iconBox._size);
|
||||
iconBox.child = textureCache.load_icon_name('stock_person', St.IconType.FULLCOLOR, iconBox._size);
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user