Call GenericDisplayItem's main actor '.actor' instead of '._group'.
As seen in #569717. Also fix up some indentation. svn path=/trunk/; revision=181
This commit is contained in:
parent
4850ea608f
commit
3392bef5c7
@ -39,10 +39,10 @@ GenericDisplayItem.prototype = {
|
|||||||
this._availableWidth = availableWidth;
|
this._availableWidth = availableWidth;
|
||||||
let me = this;
|
let me = this;
|
||||||
|
|
||||||
this._group = new Clutter.Group({reactive: true,
|
this.actor = new Clutter.Group({ reactive: true,
|
||||||
width: availableWidth,
|
width: availableWidth,
|
||||||
height: ITEM_DISPLAY_HEIGHT});
|
height: ITEM_DISPLAY_HEIGHT });
|
||||||
this._group.connect('button-press-event', function(group, e) {
|
this.actor.connect('button-press-event', function(group, e) {
|
||||||
me.emit('activate');
|
me.emit('activate');
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@ -51,13 +51,11 @@ GenericDisplayItem.prototype = {
|
|||||||
corner_radius: 4,
|
corner_radius: 4,
|
||||||
x: 0, y: 0,
|
x: 0, y: 0,
|
||||||
width: availableWidth, height: ITEM_DISPLAY_HEIGHT });
|
width: availableWidth, height: ITEM_DISPLAY_HEIGHT });
|
||||||
this._group.add_actor(this._bg);
|
this.actor.add_actor(this._bg);
|
||||||
|
|
||||||
this._name = null;
|
this._name = null;
|
||||||
this._description = null;
|
this._description = null;
|
||||||
this._icon = null;
|
this._icon = null;
|
||||||
|
|
||||||
this.actor = this._group;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
//// Public methods ////
|
//// Public methods ////
|
||||||
@ -92,7 +90,7 @@ GenericDisplayItem.prototype = {
|
|||||||
_setItemInfo: function(nameText, descriptionText, iconActor) {
|
_setItemInfo: function(nameText, descriptionText, iconActor) {
|
||||||
if (this._name != null) {
|
if (this._name != null) {
|
||||||
// this also removes this._name from the parent container,
|
// this also removes this._name from the parent container,
|
||||||
// so we don't need to call this._group.remove_actor(this._name) directly
|
// so we don't need to call this.actor.remove_actor(this._name) directly
|
||||||
this._name.destroy();
|
this._name.destroy();
|
||||||
this._name = null;
|
this._name = null;
|
||||||
}
|
}
|
||||||
@ -108,25 +106,25 @@ GenericDisplayItem.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._icon = iconActor;
|
this._icon = iconActor;
|
||||||
this._group.add_actor(this._icon);
|
this.actor.add_actor(this._icon);
|
||||||
|
|
||||||
let text_width = this._availableWidth - (ITEM_DISPLAY_ICON_SIZE + 4);
|
let text_width = this._availableWidth - (ITEM_DISPLAY_ICON_SIZE + 4);
|
||||||
this._name = new Clutter.Label({ color: ITEM_DISPLAY_NAME_COLOR,
|
this._name = new Clutter.Label({ color: ITEM_DISPLAY_NAME_COLOR,
|
||||||
font_name: "Sans 14px",
|
font_name: "Sans 14px",
|
||||||
width: text_width,
|
width: text_width,
|
||||||
ellipsize: Pango.EllipsizeMode.END,
|
ellipsize: Pango.EllipsizeMode.END,
|
||||||
text: nameText,
|
text: nameText,
|
||||||
x: ITEM_DISPLAY_ICON_SIZE + 4,
|
x: ITEM_DISPLAY_ICON_SIZE + 4,
|
||||||
y: ITEM_DISPLAY_PADDING});
|
y: ITEM_DISPLAY_PADDING });
|
||||||
this._group.add_actor(this._name);
|
this.actor.add_actor(this._name);
|
||||||
this._description = new Clutter.Label({ color: ITEM_DISPLAY_DESCRIPTION_COLOR,
|
this._description = new Clutter.Label({ color: ITEM_DISPLAY_DESCRIPTION_COLOR,
|
||||||
font_name: "Sans 12px",
|
font_name: "Sans 12px",
|
||||||
width: text_width,
|
width: text_width,
|
||||||
ellipsize: Pango.EllipsizeMode.END,
|
ellipsize: Pango.EllipsizeMode.END,
|
||||||
text: descriptionText,
|
text: descriptionText,
|
||||||
x: this._name.x,
|
x: this._name.x,
|
||||||
y: this._name.height + 4})
|
y: this._name.height + 4 });
|
||||||
this._group.add_actor(this._description);
|
this.actor.add_actor(this._description);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user