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