Setting StWidget::label-actor on some ui elements
Specifically: * Icons on Alt+Tab menu * Icons on Ctrl+Alt+Tab menu * Icons on the list of applications
This commit is contained in:
parent
cae3414854
commit
6934e4db26
@ -587,7 +587,7 @@ SwitcherList.prototype = {
|
|||||||
this._rightArrow.opacity = this._rightGradient.opacity;
|
this._rightArrow.opacity = this._rightGradient.opacity;
|
||||||
},
|
},
|
||||||
|
|
||||||
addItem : function(item) {
|
addItem : function(item, label) {
|
||||||
let bbox = new St.Button({ style_class: 'item-box',
|
let bbox = new St.Button({ style_class: 'item-box',
|
||||||
reactive: true });
|
reactive: true });
|
||||||
|
|
||||||
@ -598,6 +598,8 @@ SwitcherList.prototype = {
|
|||||||
bbox.connect('clicked', Lang.bind(this, function() { this._onItemClicked(n); }));
|
bbox.connect('clicked', Lang.bind(this, function() { this._onItemClicked(n); }));
|
||||||
bbox.connect('enter-event', Lang.bind(this, function() { this._onItemEnter(n); }));
|
bbox.connect('enter-event', Lang.bind(this, function() { this._onItemEnter(n); }));
|
||||||
|
|
||||||
|
bbox.label_actor = label;
|
||||||
|
|
||||||
this._items.push(bbox);
|
this._items.push(bbox);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -983,7 +985,7 @@ AppSwitcher.prototype = {
|
|||||||
|
|
||||||
_addIcon : function(appIcon) {
|
_addIcon : function(appIcon) {
|
||||||
this.icons.push(appIcon);
|
this.icons.push(appIcon);
|
||||||
this.addItem(appIcon.actor);
|
this.addItem(appIcon.actor, appIcon.label);
|
||||||
|
|
||||||
let n = this._arrows.length;
|
let n = this._arrows.length;
|
||||||
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
|
let arrow = new St.DrawingArea({ style_class: 'switcher-arrow' });
|
||||||
@ -1053,9 +1055,12 @@ ThumbnailList.prototype = {
|
|||||||
this._labels.push(bin);
|
this._labels.push(bin);
|
||||||
bin.add_actor(name);
|
bin.add_actor(name);
|
||||||
box.add_actor(bin);
|
box.add_actor(bin);
|
||||||
|
|
||||||
|
this.addItem(box, name);
|
||||||
|
} else {
|
||||||
|
this.addItem(box, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addItem(box);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -434,6 +434,8 @@ AppWellIcon.prototype = {
|
|||||||
this.icon = new AppIcon(app, iconParams);
|
this.icon = new AppIcon(app, iconParams);
|
||||||
this.actor.set_child(this.icon.actor);
|
this.actor.set_child(this.icon.actor);
|
||||||
|
|
||||||
|
this.actor.label_actor = this.icon.label;
|
||||||
|
|
||||||
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
||||||
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
this.actor.connect('clicked', Lang.bind(this, this._onClicked));
|
||||||
this.actor.connect('popup-menu', Lang.bind(this, this._onKeyboardPopupMenu));
|
this.actor.connect('popup-menu', Lang.bind(this, this._onKeyboardPopupMenu));
|
||||||
|
@ -323,6 +323,6 @@ CtrlAltTabSwitcher.prototype = {
|
|||||||
let text = new St.Label({ text: item.name });
|
let text = new St.Label({ text: item.name });
|
||||||
box.add(text, { x_fill: false });
|
box.add(text, { x_fill: false });
|
||||||
|
|
||||||
this.addItem(box);
|
this.addItem(box, text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -42,10 +42,10 @@ BaseIcon.prototype = {
|
|||||||
box.add_actor(this._iconBin);
|
box.add_actor(this._iconBin);
|
||||||
|
|
||||||
if (params.showLabel) {
|
if (params.showLabel) {
|
||||||
this._name = new St.Label({ text: label });
|
this.label = new St.Label({ text: label });
|
||||||
box.add_actor(this._name);
|
box.add_actor(this.label);
|
||||||
} else {
|
} else {
|
||||||
this._name = null;
|
this.label = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.createIcon)
|
if (params.createIcon)
|
||||||
@ -67,8 +67,8 @@ BaseIcon.prototype = {
|
|||||||
|
|
||||||
let childBox = new Clutter.ActorBox();
|
let childBox = new Clutter.ActorBox();
|
||||||
|
|
||||||
if (this._name) {
|
if (this.label) {
|
||||||
let [labelMinHeight, labelNatHeight] = this._name.get_preferred_height(-1);
|
let [labelMinHeight, labelNatHeight] = this.label.get_preferred_height(-1);
|
||||||
preferredHeight += this._spacing + labelNatHeight;
|
preferredHeight += this._spacing + labelNatHeight;
|
||||||
|
|
||||||
let labelHeight = availHeight >= preferredHeight ? labelNatHeight
|
let labelHeight = availHeight >= preferredHeight ? labelNatHeight
|
||||||
@ -79,7 +79,7 @@ BaseIcon.prototype = {
|
|||||||
childBox.x2 = availWidth;
|
childBox.x2 = availWidth;
|
||||||
childBox.y1 = iconSize + this._spacing;
|
childBox.y1 = iconSize + this._spacing;
|
||||||
childBox.y2 = childBox.y1 + labelHeight;
|
childBox.y2 = childBox.y1 + labelHeight;
|
||||||
this._name.allocate(childBox, flags);
|
this.label.allocate(childBox, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
childBox.x1 = Math.floor((availWidth - iconNatWidth) / 2);
|
childBox.x1 = Math.floor((availWidth - iconNatWidth) / 2);
|
||||||
@ -98,8 +98,8 @@ BaseIcon.prototype = {
|
|||||||
alloc.min_size = iconMinHeight;
|
alloc.min_size = iconMinHeight;
|
||||||
alloc.natural_size = iconNatHeight;
|
alloc.natural_size = iconNatHeight;
|
||||||
|
|
||||||
if (this._name) {
|
if (this.label) {
|
||||||
let [labelMinHeight, labelNatHeight] = this._name.get_preferred_height(forWidth);
|
let [labelMinHeight, labelNatHeight] = this.label.get_preferred_height(forWidth);
|
||||||
alloc.min_size += this._spacing + labelMinHeight;
|
alloc.min_size += this._spacing + labelMinHeight;
|
||||||
alloc.natural_size += this._spacing + labelNatHeight;
|
alloc.natural_size += this._spacing + labelNatHeight;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ SearchResult.prototype = {
|
|||||||
let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
|
let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
|
||||||
{ createIcon: this.metaInfo['createIcon'] });
|
{ createIcon: this.metaInfo['createIcon'] });
|
||||||
content.set_child(icon.actor);
|
content.set_child(icon.actor);
|
||||||
|
this.actor.label_actor = icon.label;
|
||||||
}
|
}
|
||||||
this._content = content;
|
this._content = content;
|
||||||
this.actor.set_child(content);
|
this.actor.set_child(content);
|
||||||
@ -259,6 +260,7 @@ SearchResults.prototype = {
|
|||||||
let title = new St.Label({ text: provider.name,
|
let title = new St.Label({ text: provider.name,
|
||||||
style_class: 'dash-search-button-label' });
|
style_class: 'dash-search-button-label' });
|
||||||
|
|
||||||
|
button.label_actor = title;
|
||||||
bin.set_child(title);
|
bin.set_child(title);
|
||||||
button.set_child(bin);
|
button.set_child(bin);
|
||||||
provider.actor = button;
|
provider.actor = button;
|
||||||
|
Loading…
Reference in New Issue
Block a user