dash: Make iconSize property public

As elements in the dash are scaled to accommodate a growing number
of items, the icon size used may end up rather small. In that case,
dragging items to the dash which are significantly larger than items
in the dash is getting clumsy, so it makes sense for some components
to synchronize the size of drag actors with the currently used icon
size in the dash. To enable other components to do this, make the icon
size a public property.

https://bugzilla.gnome.org/show_bug.cgi?id=639428
This commit is contained in:
Florian Müllner 2011-02-12 01:17:10 +01:00
parent aad3560ccb
commit 1d77914316

View File

@ -249,7 +249,7 @@ function Dash() {
Dash.prototype = { Dash.prototype = {
_init : function() { _init : function() {
this._maxHeight = -1; this._maxHeight = -1;
this._iconSize = 64; this.iconSize = 64;
this._shownInitially = false; this._shownInitially = false;
this._dragPlaceholder = null; this._dragPlaceholder = null;
@ -338,7 +338,7 @@ Dash.prototype = {
if (srcIsFavorite && this._favRemoveTarget == null) { if (srcIsFavorite && this._favRemoveTarget == null) {
this._favRemoveTarget = new RemoveFavoriteIcon(); this._favRemoveTarget = new RemoveFavoriteIcon();
this._favRemoveTarget.icon.setIconSize(this._iconSize); this._favRemoveTarget.icon.setIconSize(this.iconSize);
this._box.add(this._favRemoveTarget.actor); this._box.add(this._favRemoveTarget.actor);
this._adjustIconSize(); this._adjustIconSize();
this._favRemoveTarget.animateIn(); this._favRemoveTarget.animateIn();
@ -384,7 +384,7 @@ Dash.prototype = {
let item = new DashItemContainer(); let item = new DashItemContainer();
item.setChild(display.actor); item.setChild(display.actor);
display.icon.setIconSize(this._iconSize); display.icon.setIconSize(this.iconSize);
return item; return item;
}, },
@ -417,23 +417,23 @@ Dash.prototype = {
let newIconSize = 16; let newIconSize = 16;
for (let i = 0; i < iconSizes.length; i++) { for (let i = 0; i < iconSizes.length; i++) {
if (iconSizes[i] < this._iconSize + diff) if (iconSizes[i] < this.iconSize + diff)
newIconSize = iconSizes[i]; newIconSize = iconSizes[i];
} }
if (newIconSize == this._iconSize) if (newIconSize == this.iconSize)
return; return;
let oldIconSize = this._iconSize; let oldIconSize = this.iconSize;
this._iconSize = newIconSize; this.iconSize = newIconSize;
let scale = oldIconSize / newIconSize; let scale = oldIconSize / newIconSize;
for (let i = 0; i < iconChildren.length; i++) { for (let i = 0; i < iconChildren.length; i++) {
let icon = iconChildren[i]._delegate.child._delegate.icon; let icon = iconChildren[i]._delegate.child._delegate.icon;
// Set the new size immediately, to keep the icons' sizes // Set the new size immediately, to keep the icons' sizes
// in sync with this._iconSize // in sync with this.iconSize
icon.setIconSize(this._iconSize); icon.setIconSize(this.iconSize);
// Don't animate the icon size change when the overview // Don't animate the icon size change when the overview
// is not visible or when initially filling the dash // is not visible or when initially filling the dash