st: Remove StIconType

GTK+ works by explicitly specifying a -symbolic suffix for all icons.
Do the same here.

https://bugzilla.gnome.org/show_bug.cgi?id=682540
This commit is contained in:
Jasper St. Pierre 2012-05-30 09:58:37 -04:00
parent 042c1fd54b
commit c21b1e5fe0
32 changed files with 94 additions and 300 deletions

View File

@ -261,7 +261,7 @@ const AutorunResidentSource = new Lang.Class({
Extends: MessageTray.Source,
_init: function() {
this.parent(_("Removable Devices"), 'media-removable', St.IconType.FULLCOLOR);
this.parent(_("Removable Devices"), 'media-removable');
this.showInLockScreen = false;
this._mounts = [];

View File

@ -318,7 +318,6 @@ const CtrlAltTabSwitcher = new Lang.Class({
let icon = item.iconActor;
if (!icon) {
icon = new St.Icon({ icon_name: item.iconName,
icon_type: St.IconType.SYMBOLIC,
icon_size: POPUP_APPICON_SIZE });
}
box.add(icon, { x_fill: false, y_fill: false } );

View File

@ -256,10 +256,9 @@ const ShowAppsIcon = new Lang.Class({
_createIcon: function(size) {
this._iconActor = new St.Icon({ icon_name: 'view-grid-symbolic',
icon_size: size,
style_class: 'show-apps-icon',
track_hover: true,
icon_type: St.IconType.SYMBOLIC,
icon_size: size });
track_hover: true });
return this._iconActor;
},

View File

@ -89,7 +89,7 @@ const shutdownDialogContent = {
label: C_("button", "Restart") },
{ signal: 'ConfirmedShutdown',
label: C_("button", "Power Off") }],
iconName: 'system-shutdown',
iconName: 'system-shutdown-symbolic',
iconStyleClass: 'end-session-dialog-shutdown-icon'
};
@ -104,7 +104,7 @@ const restartDialogContent = {
endDescription: _("Restarting the system."),
confirmButtons: [{ signal: 'ConfirmedReboot',
label: C_("button", "Restart") }],
iconName: 'system-shutdown',
iconName: 'system-shutdown-symbolic',
iconStyleClass: 'end-session-dialog-shutdown-icon'
};
@ -327,7 +327,6 @@ const EndSessionDialog = new Lang.Class({
let textureCache = St.TextureCache.get_default();
let icon = textureCache.load_icon_name(this._iconBin.get_theme_node(),
iconName,
St.IconType.SYMBOLIC,
_DIALOG_ICON_SIZE);
this._iconBin.child = icon;

View File

@ -542,7 +542,7 @@ const KeyboardSource = new Lang.Class({
_init: function(keyboard) {
this._keyboard = keyboard;
this.parent(_("Keyboard"), 'input-keyboard', St.IconType.SYMBOLIC);
this.parent(_("Keyboard"), 'input-keyboard-symbolic');
},
handleSummaryClick: function() {

View File

@ -869,7 +869,6 @@ const LookingGlass = new Lang.Class({
let toolbar = new St.BoxLayout({ name: 'Toolbar' });
this.actor.add_actor(toolbar);
let inspectIcon = new St.Icon({ icon_name: 'gtk-color-picker',
icon_type: St.IconType.FULLCOLOR,
icon_size: 24 });
toolbar.add_actor(inspectIcon);
inspectIcon.reactive = true;

View File

@ -1034,10 +1034,9 @@ const Source = new Lang.Class({
SOURCE_ICON_SIZE: 48,
_init: function(title, iconName, iconType) {
_init: function(title, iconName) {
this.title = title;
this.iconName = iconName;
this.iconType = iconType;
this.isTransient = false;
this.isChat = false;
@ -1084,7 +1083,6 @@ const Source = new Lang.Class({
// something more fancy.
createIcon: function(size) {
return new St.Icon({ icon_name: this.iconName,
icon_type: this.iconType,
icon_size: size });
},
@ -2461,7 +2459,7 @@ const SystemNotificationSource = new Lang.Class({
Extends: Source,
_init: function() {
this.parent(_("System Information"), 'dialog-information', St.IconType.SYMBOLIC);
this.parent(_("System Information"), 'dialog-information-symbolic');
this.setTransient(true);
},

View File

@ -357,7 +357,6 @@ const NotificationDaemon = new Lang.Class({
let gicon = this._iconForNotificationData(icon, hints);
let iconActor = new St.Icon({ gicon: gicon,
icon_type: St.IconType.FULLCOLOR,
icon_size: MessageTray.NOTIFICATION_ICON_SIZE });
if (notification == null) {

View File

@ -210,7 +210,7 @@ const Overview = new Lang.Class({
// Translators: this is the name of the dock/favorites area on
// the left of the overview
Main.ctrlAltTabManager.addGroup(this._dash.actor, _("Dash"), 'user-bookmarks');
Main.ctrlAltTabManager.addGroup(this._dash.actor, _("Dash"), 'user-bookmarks-symbolic');
Main.layoutManager.connect('monitors-changed', Lang.bind(this, this._relayout));
this._relayout();

View File

@ -968,7 +968,7 @@ const Panel = new Lang.Class({
this._menus.addMenu(this._dateMenu.menu);
Main.layoutManager.panelBox.add(this.actor);
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'start-here',
Main.ctrlAltTabManager.addGroup(this.actor, _("Top Bar"), 'start-here-symbolic',
{ sortGroup: CtrlAltTab.SortGroup.TOP });
},

View File

@ -242,7 +242,6 @@ const SystemStatusButton = new Lang.Class({
addIcon: function(gicon) {
let icon = new St.Icon({ gicon: gicon,
icon_type: St.IconType.SYMBOLIC,
style_class: 'system-status-icon' });
this._box.add_actor(icon);

View File

@ -117,8 +117,7 @@ const RemoteSearchProvider = new Lang.Class({
createIcon: function(size, meta) {
if (meta['gicon']) {
return new St.Icon({ gicon: Gio.icon_new_for_string(meta['gicon']),
icon_size: size,
icon_type: St.IconType.FULLCOLOR });
icon_size: size });
} else if (meta['icon-data']) {
let [width, height, rowStride, hasAlpha,
bitsPerSample, nChannels, data] = meta['icon-data'];
@ -129,8 +128,7 @@ const RemoteSearchProvider = new Lang.Class({
// Ugh, but we want to fall back to something ...
return new St.Icon({ icon_name: 'text-x-generic',
icon_size: size,
icon_type: St.IconType.FULLCOLOR });
icon_size: size });
},
_getResultsFinished: function(results, error) {

View File

@ -240,7 +240,7 @@ const ShellUnmountNotifier = new Lang.Class({
Extends: MessageTray.Source,
_init: function() {
this.parent('', 'media-removable', St.IconType.FULLCOLOR);
this.parent('', 'media-removable');
this._notification = null;
Main.messageTray.add(this);

View File

@ -36,7 +36,7 @@ const ATIndicator = new Lang.Class({
Extends: PanelMenu.SystemStatusButton,
_init: function() {
this.parent('preferences-desktop-accessibility', _("Accessibility"));
this.parent('preferences-desktop-accessibility-symbolic', _("Accessibility"));
let highContrast = this._buildHCItem();
this.menu.addMenuItem(highContrast);

View File

@ -24,7 +24,7 @@ const Indicator = new Lang.Class({
Extends: PanelMenu.SystemStatusButton,
_init: function() {
this.parent('bluetooth-disabled', _("Bluetooth"));
this.parent('bluetooth-disabled-symbolic', _("Bluetooth"));
this._applet = new GnomeBluetoothApplet.Applet();
@ -111,10 +111,10 @@ const Indicator = new Lang.Class({
if (on) {
this._discoverable.actor.show();
this.setIcon('bluetooth-active');
this.setIcon('bluetooth-active-symbolic');
} else {
this._discoverable.actor.hide();
this.setIcon('bluetooth-disabled');
this.setIcon('bluetooth-disabled-symbolic');
}
},
@ -306,7 +306,7 @@ const Indicator = new Lang.Class({
_ensureSource: function() {
if (!this._source) {
this._source = new MessageTray.Source(_("Bluetooth"), 'bluetooth-active', St.IconType.SYMBOLIC);
this._source = new MessageTray.Source(_("Bluetooth"), 'bluetooth-active-symbolic');
Main.messageTray.add(this._source);
}
},

View File

@ -122,7 +122,7 @@ const NMNetworkMenuItem = new Lang.Class({
this._secureIcon = new St.Icon({ style_class: 'popup-menu-icon' });
if (this.bestAP._secType != NMAccessPointSecurity.UNKNOWN &&
this.bestAP._secType != NMAccessPointSecurity.NONE)
this._secureIcon.icon_name = 'network-wireless-encrypted';
this._secureIcon.icon_name = 'network-wireless-encrypted-symbolic';
this._icons.add_actor(this._secureIcon);
},
@ -133,9 +133,9 @@ const NMNetworkMenuItem = new Lang.Class({
_getIcon: function() {
if (this.bestAP.mode == NM80211Mode.ADHOC)
return 'network-workgroup';
return 'network-workgroup-symbolic';
else
return 'network-wireless-signal-' + signalToIcon(this.bestAP.strength);
return 'network-wireless-signal-' + signalToIcon(this.bestAP.strength) + '-symbolic';
}
});
@ -761,7 +761,7 @@ const NMDeviceModem = new Lang.Class({
},
_getSignalIcon: function() {
return 'network-cellular-signal-' + signalToIcon(this.mobileDevice.signal_quality);
return 'network-cellular-signal-' + signalToIcon(this.mobileDevice.signal_quality) + '-symbolic';
},
_createSection: function() {
@ -1469,7 +1469,7 @@ const NMDeviceWireless = new Lang.Class({
{ reactive: false });
else
this._activeConnectionItem = new PopupMenu.PopupImageMenuItem(title,
'network-wireless-connected',
'network-wireless-connected-symbolic',
{ reactive: false });
this._activeConnectionItem.setShowDot(true);
},
@ -1570,7 +1570,7 @@ const NMApplet = new Lang.Class({
_init: function() {
this.parent('network-offline', _('Network'));
this.secondaryIcon = this.addIcon(new Gio.ThemedIcon({ name: 'network-vpn' }));
this.secondaryIcon = this.addIcon(new Gio.ThemedIcon({ name: 'network-vpn-symbolic' }));
this.secondaryIcon.hide();
this._isLocked = false;
@ -1689,8 +1689,7 @@ const NMApplet = new Lang.Class({
_ensureSource: function() {
if (!this._source) {
this._source = new MessageTray.Source(_("Network Manager"),
'network-transmit-receive',
St.IconType.SYMBOLIC);
'network-transmit-receive-symbolic');
this._source.connect('destroy', Lang.bind(this, function() {
this._source = null;
@ -1761,7 +1760,6 @@ const NMApplet = new Lang.Class({
this._ensureSource();
let icon = new St.Icon({ icon_name: iconName,
icon_type: St.IconType.SYMBOLIC,
icon_size: MessageTray.NOTIFICATION_ICON_SIZE });
device._notification = new MessageTray.Notification(this._source, title, text,
{ icon: icon });
@ -1804,7 +1802,6 @@ const NMApplet = new Lang.Class({
let wrapperClass = this._dtypes[device.get_device_type()];
if (wrapperClass) {
let wrapper = this._makeWrapperDevice(wrapperClass, device);
let section = this._devices[wrapper.category].section;
let devices = this._devices[wrapper.category].devices;
@ -2075,7 +2072,7 @@ const NMApplet = new Lang.Class({
this.actor.visible = this.mainIcon.visible && !this._isLocked;
if (!this._client.networking_enabled) {
this.setIcon('network-offline');
this.setIcon('network-offline-symbolic');
this._hideDevices();
this._statusItem.label.text = _("Networking is disabled");
this._statusSection.actor.show();
@ -2093,22 +2090,22 @@ const NMApplet = new Lang.Class({
let hasMobileIcon = false;
if (!mc) {
this.setIcon('network-offline');
this.setIcon('network-offline-symbolic');
} else if (mc.state == NetworkManager.ActiveConnectionState.ACTIVATING) {
switch (mc._section) {
case NMConnectionCategory.WWAN:
this.setIcon('network-cellular-acquiring');
this.setIcon('network-cellular-acquiring-symbolic');
break;
case NMConnectionCategory.WIRELESS:
this.setIcon('network-wireless-acquiring');
this.setIcon('network-wireless-acquiring-symbolic');
break;
case NMConnectionCategory.WIRED:
this.setIcon('network-wired-acquiring');
this.setIcon('network-wired-acquiring-symbolic');
break;
default:
// fallback to a generic connected icon
// (it could be a private connection of some other user)
this.setIcon('network-wired-acquiring');
this.setIcon('network-wired-acquiring-symbolic');
}
} else {
let dev;
@ -2123,17 +2120,17 @@ const NMApplet = new Lang.Class({
log('An active wireless connection, in infrastructure mode, involves no access point?');
break;
}
this.setIcon('network-wireless-connected');
this.setIcon('network-wireless-connected-symbolic');
} else {
if (this._activeAccessPoint != ap) {
if (this._accessPointUpdateId)
this._activeAccessPoint.disconnect(this._accessPointUpdateId);
this._activeAccessPoint = ap;
this._activeAccessPointUpdateId = ap.connect('notify::strength', Lang.bind(this, function() {
this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength));
this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength) + '-symbolic');
}));
}
this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength));
this.setIcon('network-wireless-signal-' + signalToIcon(ap.strength) + '-symbolic');
hasApIcon = true;
}
break;
@ -2142,7 +2139,7 @@ const NMApplet = new Lang.Class({
break;
}
case NMConnectionCategory.WIRED:
this.setIcon('network-wired');
this.setIcon('network-wired-symbolic');
break;
case NMConnectionCategory.WWAN:
dev = mc._primaryDevice;
@ -2152,7 +2149,7 @@ const NMApplet = new Lang.Class({
}
if (!dev.mobileDevice) {
// this can happen for bluetooth in PAN mode
this.setIcon('network-cellular-connected');
this.setIcon('network-cellular-connected-symbolic');
break;
}
@ -2161,16 +2158,16 @@ const NMApplet = new Lang.Class({
this._mobileUpdateDevice.disconnect(this._mobileUpdateId);
this._mobileUpdateDevice = dev.mobileDevice;
this._mobileUpdateId = dev.mobileDevice.connect('notify::signal-quality', Lang.bind(this, function() {
this.setIcon('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality));
this.setIcon('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality) + '-symbolic');
}));
}
this.setIcon('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality));
this.setIcon('network-cellular-signal-' + signalToIcon(dev.mobileDevice.signal_quality) + '-symbolic');
hasMobileIcon = true;
break;
default:
// fallback to a generic connected icon
// (it could be a private connection of some other user)
this.setIcon('network-wired');
this.setIcon('network-wired-symbolic');
break;
}
}

View File

@ -52,7 +52,7 @@ const Indicator = new Lang.Class({
Extends: PanelMenu.SystemStatusButton,
_init: function() {
this.parent('battery-missing', _("Battery"));
this.parent('battery-missing-symbolic', _("Battery"));
this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
@ -182,7 +182,6 @@ const DeviceItem = new Lang.Class({
this._label = new St.Label({ text: this._deviceTypeToString(device_type) });
this._icon = new St.Icon({ gicon: Gio.icon_new_for_string(icon),
icon_type: St.IconType.SYMBOLIC,
style_class: 'popup-menu-icon' });
this._box.add_actor(this._icon);

View File

@ -156,14 +156,14 @@ const VolumeMenu = new Lang.Class({
_volumeToIcon: function(volume) {
if (volume <= 0) {
return 'audio-volume-muted';
return 'audio-volume-muted-symbolic';
} else {
let n = Math.floor(3 * volume / this._volumeMax) + 1;
if (n < 2)
return 'audio-volume-low';
return 'audio-volume-low-symbolic';
if (n >= 3)
return 'audio-volume-high';
return 'audio-volume-medium';
return 'audio-volume-high-symbolic';
return 'audio-volume-medium-symbolic';
}
},
@ -197,7 +197,7 @@ const VolumeMenu = new Lang.Class({
slider.setValue(muted ? 0 : (this[property].volume / this._volumeMax));
if (property == '_output') {
if (muted)
this.emit('icon-changed', 'audio-volume-muted');
this.emit('icon-changed', 'audio-volume-muted-symbolic');
else
this.emit('icon-changed', this._volumeToIcon(this._output.volume));
}

View File

@ -383,8 +383,7 @@ const Client = new Lang.Class({
_ensureSubscriptionSource: function() {
if (this._subscriptionSource == null) {
this._subscriptionSource = new MessageTray.Source(_("Subscription request"),
'gtk-dialog-question',
St.IconType.FULLCOLOR);
'gtk-dialog-question');
Main.messageTray.add(this._subscriptionSource);
this._subscriptionSource.connect('destroy', Lang.bind(this, function () {
this._subscriptionSource = null;
@ -420,8 +419,7 @@ const Client = new Lang.Class({
_ensureAccountSource: function() {
if (this._accountSource == null) {
this._accountSource = new MessageTray.Source(_("Connection error"),
'gtk-dialog-error',
St.IconType.FULLCOLOR);
'gtk-dialog-error');
Main.messageTray.add(this._accountSource);
this._accountSource.connect('destroy', Lang.bind(this, function () {
this._accountSource = null;
@ -497,7 +495,6 @@ const ChatSource = new Lang.Class({
this._iconBox.child = textureCache.load_uri_async(uri, this._iconBox._size, this._iconBox._size);
} else {
this._iconBox.child = new St.Icon({ icon_name: 'avatar-default',
icon_type: St.IconType.FULLCOLOR,
icon_size: this._iconBox._size });
}
@ -506,8 +503,7 @@ const ChatSource = new Lang.Class({
createSecondaryIcon: function() {
let iconBox = new St.Bin();
iconBox.child = new St.Icon({ style_class: 'secondary-icon',
icon_type: St.IconType.FULLCOLOR });
iconBox.child = new St.Icon({ style_class: 'secondary-icon' });
let presenceType = this._contact.get_presence_type();
switch (presenceType) {
@ -1197,7 +1193,6 @@ const SubscriptionRequestNotification = new Lang.Class({
}
else {
iconBox.child = new St.Icon({ icon_name: 'avatar-default',
icon_type: St.IconType.FULLCOLOR,
icon_size: iconBox._size });
}

View File

@ -67,7 +67,6 @@ const UserAvatarWidget = new Lang.Class({
} else {
this.actor.style = null;
this.actor.child = new St.Icon({ icon_name: 'avatar-default',
icon_type: St.IconType.SYMBOLIC,
icon_size: DIALOG_ICON_SIZE });
}
}
@ -164,22 +163,22 @@ const IMStatusChooserItem = new Lang.Class({
let item;
item = new IMStatusItem(_("Available"), 'user-available');
item = new IMStatusItem(_("Available"), 'user-available-symbolic');
this._combo.addMenuItem(item, IMStatus.AVAILABLE);
item = new IMStatusItem(_("Busy"), 'user-busy');
item = new IMStatusItem(_("Busy"), 'user-busy-symbolic');
this._combo.addMenuItem(item, IMStatus.BUSY);
item = new IMStatusItem(_("Invisible"), 'user-invisible');
item = new IMStatusItem(_("Invisible"), 'user-invisible-symbolic');
this._combo.addMenuItem(item, IMStatus.HIDDEN);
item = new IMStatusItem(_("Away"), 'user-away');
item = new IMStatusItem(_("Away"), 'user-away-symbolic');
this._combo.addMenuItem(item, IMStatus.AWAY);
item = new IMStatusItem(_("Idle"), 'user-idle');
item = new IMStatusItem(_("Idle"), 'user-idle-symbolic');
this._combo.addMenuItem(item, IMStatus.IDLE);
item = new IMStatusItem(_("Unavailable"), 'user-offline');
item = new IMStatusItem(_("Unavailable"), 'user-offline-symbolic');
this._combo.addMenuItem(item, IMStatus.OFFLINE);
this._combo.connect('active-item-changed',
@ -480,17 +479,17 @@ const UserMenuButton = new Lang.Class({
box.add(this._iconBox, { y_align: St.Align.MIDDLE, y_fill: false });
let textureCache = St.TextureCache.get_default();
this._offlineIcon = new St.Icon({ icon_name: 'user-offline',
this._offlineIcon = new St.Icon({ icon_name: 'user-offline-symbolic',
style_class: 'popup-menu-icon' });
this._availableIcon = new St.Icon({ icon_name: 'user-available',
this._availableIcon = new St.Icon({ icon_name: 'user-available-symbolic',
style_class: 'popup-menu-icon' });
this._busyIcon = new St.Icon({ icon_name: 'user-busy',
this._busyIcon = new St.Icon({ icon_name: 'user-busy-symbolic',
style_class: 'popup-menu-icon' });
this._invisibleIcon = new St.Icon({ icon_name: 'user-invisible',
this._invisibleIcon = new St.Icon({ icon_name: 'user-invisible-symbolic',
style_class: 'popup-menu-icon' });
this._awayIcon = new St.Icon({ icon_name: 'user-away',
this._awayIcon = new St.Icon({ icon_name: 'user-away-symbolic',
style_class: 'popup-menu-icon' });
this._idleIcon = new St.Icon({ icon_name: 'user-idle',
this._idleIcon = new St.Icon({ icon_name: 'user-idle-symbolic',
style_class: 'popup-menu-icon' });
this._pendingIcon = new St.Icon({ icon_name: 'user-status-pending',
style_class: 'popup-menu-icon' });

View File

@ -73,11 +73,9 @@ const ViewSelector = new Lang.Class({
global.stage.connect('notify::key-focus', Lang.bind(this, this._onStageKeyFocusChanged));
this._inactiveIcon = new St.Icon({ style_class: 'search-entry-icon',
icon_name: 'edit-find',
icon_type: St.IconType.SYMBOLIC });
icon_name: 'edit-find-symbolic' });
this._activeIcon = new St.Icon({ style_class: 'search-entry-icon',
icon_name: 'edit-clear',
icon_type: St.IconType.SYMBOLIC });
icon_name: 'edit-clear-symbolic' });
this._entry.set_secondary_icon(this._inactiveIcon);
this._iconClickedId = 0;
@ -85,15 +83,15 @@ const ViewSelector = new Lang.Class({
this._workspacesDisplay = new WorkspacesView.WorkspacesDisplay();
this._workspacesPage = this._addPage(this._workspacesDisplay.actor, null,
_("Windows"), 'text-x-generic');
_("Windows"), 'text-x-generic-symbolic');
this._appDisplay = new AppDisplay.AllAppDisplay();
this._appsPage = this._addPage(this._appDisplay.actor, null,
_("Applications"), 'system-run');
_("Applications"), 'system-run-symbolic');
this._searchResults = new SearchDisplay.SearchResults(this._searchSystem);
this._searchPage = this._addPage(this._searchResults.actor, this._entry,
_("Search"), 'edit-find');
_("Search"), 'edit-find-symbolic');
// Default search providers
// Wanda comes obviously first

View File

@ -55,9 +55,7 @@ const WandaIcon = new Lang.Class({
if (!this._imageFile) {
return new St.Icon({ icon_name: 'face-smile',
icon_type: St.IconType.FULLCOLOR,
icon_size: iconSize
});
icon_size: iconSize });
}
this._animations = St.TextureCache.get_default().load_sliced_image(this._imageFile, this._imgWidth, this._imgHeight);
@ -183,7 +181,6 @@ const WandaSearchProvider = new Lang.Class({
// triggers an assertion failure)
return St.TextureCache.get_default().load_icon_name(null,
'face-smile',
St.IconType.FULLCOLOR,
iconSize);
}
}]);

View File

@ -59,8 +59,7 @@ function init() {
x_fill: true,
y_fill: false,
track_hover: true });
let icon = new St.Icon({ icon_name: 'system-run',
icon_type: St.IconType.SYMBOLIC,
let icon = new St.Icon({ icon_name: 'system-run-symbolic',
style_class: 'system-status-icon' });
button.set_child(icon);

View File

@ -172,8 +172,7 @@ show_capslock_feedback (StEntry *entry)
{
ClutterActor *icon = g_object_new (ST_TYPE_ICON,
"style-class", "capslock-warning",
"icon-type", ST_ICON_SYMBOLIC,
"icon-name", "dialog-warning",
"icon-name", "dialog-warning-symbolic",
NULL);
st_entry_set_secondary_icon (entry, icon);

View File

@ -37,7 +37,6 @@ enum
PROP_GICON,
PROP_ICON_NAME,
PROP_ICON_TYPE,
PROP_ICON_SIZE
};
@ -53,7 +52,6 @@ struct _StIconPrivate
guint opacity_handler_id;
GIcon *gicon;
StIconType icon_type;
gint prop_icon_size; /* icon size set as property */
gint theme_icon_size; /* icon size from theme node */
gint icon_size; /* icon size we are using */
@ -68,7 +66,6 @@ static void st_icon_update (StIcon *icon);
static gboolean st_icon_update_icon_size (StIcon *icon);
#define DEFAULT_ICON_SIZE 48
#define DEFAULT_ICON_TYPE ST_ICON_SYMBOLIC
static void
st_icon_set_property (GObject *gobject,
@ -88,10 +85,6 @@ st_icon_set_property (GObject *gobject,
st_icon_set_icon_name (icon, g_value_get_string (value));
break;
case PROP_ICON_TYPE:
st_icon_set_icon_type (icon, g_value_get_enum (value));
break;
case PROP_ICON_SIZE:
st_icon_set_icon_size (icon, g_value_get_int (value));
break;
@ -120,10 +113,6 @@ st_icon_get_property (GObject *gobject,
g_value_set_string (value, st_icon_get_icon_name (icon));
break;
case PROP_ICON_TYPE:
g_value_set_enum (value, st_icon_get_icon_type (icon));
break;
case PROP_ICON_SIZE:
g_value_set_int (value, st_icon_get_icon_size (icon));
break;
@ -343,14 +332,6 @@ st_icon_class_init (StIconClass *klass)
NULL, ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_ICON_NAME, pspec);
pspec = g_param_spec_enum ("icon-type",
"Icon type",
"The type of icon that should be used",
ST_TYPE_ICON_TYPE,
DEFAULT_ICON_TYPE,
ST_PARAM_READWRITE | G_PARAM_DEPRECATED);
g_object_class_install_property (object_class, PROP_ICON_TYPE, pspec);
pspec = g_param_spec_int ("icon-size",
"Icon size",
"The size if the icon, if positive. Otherwise the size will be derived from the current style",
@ -366,7 +347,6 @@ st_icon_init (StIcon *self)
self->priv->icon_size = DEFAULT_ICON_SIZE;
self->priv->prop_icon_size = -1;
self->priv->icon_type = DEFAULT_ICON_TYPE;
self->priv->shadow_material = COGL_INVALID_HANDLE;
self->priv->shadow_width = -1;
@ -564,12 +544,7 @@ st_icon_set_icon_name (StIcon *icon,
g_object_unref (priv->gicon);
if (icon_name)
{
if (priv->icon_type == ST_ICON_SYMBOLIC)
priv->gicon = _st_make_symbolic_themed_icon (icon_name);
else
priv->gicon = g_themed_icon_new_with_default_fallbacks (icon_name);
}
else
priv->gicon = NULL;
@ -579,52 +554,6 @@ st_icon_set_icon_name (StIcon *icon,
st_icon_update (icon);
}
/**
* st_icon_get_icon_type:
* @icon: a #StIcon
*
* Gets the type of icon we'll look up to display in the actor.
* See st_icon_set_icon_type().
*
* Return value: the icon type.
*/
StIconType
st_icon_get_icon_type (StIcon *icon)
{
g_return_val_if_fail (ST_IS_ICON (icon), DEFAULT_ICON_TYPE);
return icon->priv->icon_type;
}
/**
* st_icon_set_icon_type:
* @icon: a #StIcon
* @icon_type: the type of icon to use
*
* Sets the type of icon we'll look up to display in the actor.
* The icon type determines whether we use a symbolic icon or
* a full color icon and also is used for specific handling for
* application and document icons.
*/
void
st_icon_set_icon_type (StIcon *icon,
StIconType icon_type)
{
StIconPrivate *priv;
g_return_if_fail (ST_IS_ICON (icon));
priv = icon->priv;
if (icon_type == priv->icon_type)
return;
priv->icon_type = icon_type;
st_icon_update (icon);
g_object_notify (G_OBJECT (icon), "icon-type");
}
/**
* st_icon_get_gicon:
* @icon: an icon

View File

@ -88,9 +88,6 @@ ClutterActor* st_icon_new (void);
const gchar *st_icon_get_icon_name (StIcon *icon);
void st_icon_set_icon_name (StIcon *icon, const gchar *icon_name);
void st_icon_set_icon_type (StIcon *icon, StIconType icon_type);
StIconType st_icon_get_icon_type (StIcon *icon);
gint st_icon_get_icon_size (StIcon *icon);
void st_icon_set_icon_size (StIcon *icon, gint size);

View File

@ -691,55 +691,3 @@ _st_paint_shadow_with_opacity (StShadow *shadow_spec,
shadow_box.x2, shadow_box.y2,
0, 0, 1, 1);
}
/* generates names like g_themed_icon_new_with_default_fallbacks(),
* but *only* symbolic names
*/
static char **
symbolic_names_for_icon (const char *name)
{
char **parts, **names;
int i, numnames;
parts = g_strsplit (name, "-", -1);
numnames = g_strv_length (parts);
names = g_new (char *, numnames + 1);
for (i = 0; parts[i]; i++)
{
if (i == 0)
{
names[i] = g_strdup_printf ("%s-symbolic", parts[i]);
}
else
{
names[i] = g_strdup_printf ("%.*s-%s-symbolic",
(int) (strlen (names[i - 1]) - strlen ("-symbolic")),
names[i - 1], parts[i]);
}
}
names[i] = NULL;
g_strfreev (parts);
/* need to reverse here, because longest (most specific)
name has to come first */
for (i = 0; i < (numnames / 2); i++) {
char *tmp = names[i];
names[i] = names[numnames - i - 1];
names[numnames - i - 1] = tmp;
}
return names;
}
GIcon *
_st_make_symbolic_themed_icon (const char *icon_name)
{
char **names;
GIcon *themed;
names = symbolic_names_for_icon (icon_name);
themed = g_themed_icon_new_from_names (names, -1);
g_strfreev (names);
return themed;
}

View File

@ -79,6 +79,4 @@ void _st_paint_shadow_with_opacity (StShadow *shadow_spec,
ClutterActorBox *box,
guint8 paint_opacity);
GIcon *_st_make_symbolic_themed_icon (const char *icon_name);
#endif /* __ST_PRIVATE_H__ */

View File

@ -1121,29 +1121,15 @@ st_texture_cache_load_sliced_image (StTextureCache *cache,
return actor;
}
/**
* StIconType:
* @ST_ICON_SYMBOLIC: a symbolic (ie, mostly monochrome) icon
* @ST_ICON_FULLCOLOR: a full-color icon
*
* Describes what style of icon is desired in a call to
* st_texture_cache_load_icon_name() or st_texture_cache_load_gicon().
* Use %ST_ICON_SYMBOLIC for symbolic icons (eg, for the panel and
* much of the rest of the shell chrome) or %ST_ICON_FULLCOLOR for a
* full-color icon.
*/
/**
* st_texture_cache_load_icon_name:
* @cache: The texture cache instance
* @theme_node: (allow-none): a #StThemeNode
* @name: Name of a themed icon
* @icon_type: the type of icon to load
* @size: Size of themed icon
*
* Load a themed icon into a texture. See the #StIconType documentation
* for an explanation of how @icon_type affects the returned icon. The
* colors used for symbolic icons are derived from @theme_node.
* Load a themed icon into a texture. The colors used for symbolic
* icons are derived from @theme_node.
*
* Return Value: (transfer none): A new #ClutterTexture for the icon
*/
@ -1151,47 +1137,23 @@ ClutterActor *
st_texture_cache_load_icon_name (StTextureCache *cache,
StThemeNode *theme_node,
const char *name,
StIconType icon_type,
gint size)
{
ClutterActor *texture;
GIcon *themed;
g_return_val_if_fail (!(icon_type == ST_ICON_SYMBOLIC && theme_node == NULL), NULL);
switch (icon_type)
{
case ST_ICON_SYMBOLIC:
themed = _st_make_symbolic_themed_icon (name);
themed = g_themed_icon_new_with_default_fallbacks (name);
texture = load_gicon_with_colors (cache, themed, size,
st_theme_node_get_icon_colors (theme_node));
theme_node ? st_theme_node_get_icon_colors (theme_node) : NULL);
g_object_unref (themed);
if (texture == NULL)
{
/* We don't have an equivalent of image-missing
* for the symbolic icon theme, so just create a blank
* actor. */
texture = (ClutterActor *) create_default_texture ();
clutter_actor_set_size (texture, size, size);
}
return texture;
break;
case ST_ICON_FULLCOLOR:
themed = g_themed_icon_new_with_default_fallbacks (name);
texture = load_gicon_with_colors (cache, themed, size, NULL);
g_object_unref (themed);
if (texture == NULL)
{
themed = g_themed_icon_new ("image-missing");
texture = load_gicon_with_colors (cache, themed, size, NULL);
g_object_unref (themed);
}
return texture;
break;
default:
g_assert_not_reached ();
}
}
/**

View File

@ -81,7 +81,6 @@ ClutterActor *st_texture_cache_bind_pixbuf_property (StTextureCache *cache,
ClutterActor *st_texture_cache_load_icon_name (StTextureCache *cache,
StThemeNode *theme_node,
const char *name,
StIconType icon_type,
gint size);
ClutterActor *st_texture_cache_load_gicon (StTextureCache *cache,

View File

@ -40,11 +40,6 @@ typedef enum {
ST_ALIGN_END
} StAlign;
typedef enum {
ST_ICON_SYMBOLIC,
ST_ICON_FULLCOLOR
} StIconType;
typedef enum {
ST_BACKGROUND_SIZE_AUTO,
ST_BACKGROUND_SIZE_CONTAIN,

View File

@ -28,27 +28,21 @@ function test() {
}
addTest("Symbolic",
{ icon_name: 'battery-full',
icon_type: St.IconType.SYMBOLIC,
{ icon_name: 'battery-full-symbolic',
icon_size: 48 });
addTest("Full color",
{ icon_name: 'battery-full',
icon_type: St.IconType.FULLCOLOR,
icon_size: 48 });
addTest("Default size",
{ icon_name: 'battery-full',
icon_type: St.IconType.SYMBOLIC });
{ icon_name: 'battery-full-symbolic' });
addTest("Size set by property",
{ icon_name: 'battery-full',
icon_type: St.IconType.SYMBOLIC,
{ icon_name: 'battery-full-symbolic',
icon_size: 32 });
addTest("Size set by style",
{ icon_name: 'battery-full',
icon_type: St.IconType.SYMBOLIC,
{ icon_name: 'battery-full-symbolic',
style: 'icon-size: 1em;' });
addTest("16px icon in 48px icon widget",
{ icon_name: 'battery-full',
icon_type: St.IconType.SYMBOLIC,
{ icon_name: 'battery-full-symbolic',
style: 'icon-size: 16px; width: 48px; height: 48px; border: 1px solid black;' });
function iconRow(icons, box_style) {
@ -56,7 +50,6 @@ function test() {
for each (let iconName in icons) {
hb.add(new St.Icon({ icon_name: iconName,
icon_type: St.IconType.SYMBOLIC,
icon_size: 48 }));
}
@ -66,16 +59,16 @@ function test() {
let normalCss = 'background: white; color: black; padding: 10px 10px;';
let reversedCss = 'background: black; color: white; warning-color: #ffcc00; error-color: #ff0000; padding: 10px 10px;';
let batteryIcons = ['battery-full-charging',
'battery-full',
'battery-good',
'battery-low',
'battery-caution' ];
let batteryIcons = ['battery-full-charging-symbolic',
'battery-full-symbolic',
'battery-good-symbolic',
'battery-low-symbolic',
'battery-caution-symbolic' ];
let volumeIcons = ['audio-volume-high',
'audio-volume-medium',
'audio-volume-low',
'audio-volume-muted' ];
let volumeIcons = ['audio-volume-high-symbolic',
'audio-volume-medium-symbolic',
'audio-volume-low-symbolic',
'audio-volume-muted-symbolic' ];
iconRow(batteryIcons, normalCss);
iconRow(batteryIcons, reversedCss);