iconGrid: Change IconGrid.addItem() to take an object instead of an actor
IconGrid has never really been a general purpose container, but has always been used in conjunction with BaseIcon. IconGrid will soon gain the ability to adjust the item size dynamically to adapt to the available space, which will require that we can make some more assumptions about the items added to the grid (namely: we need access to BaseIcon's setIconSize() method). So change addItem() to take an object instead, which should have an actor and a (BaseIcon) icon property. Based on a patch by Carlos Soriano. https://bugzilla.gnome.org/show_bug.cgi?id=706081
This commit is contained in:

committed by
Carlos Soriano

parent
9a8bf3b881
commit
792b963bda
@ -126,23 +126,25 @@ const GridSearchResult = new Lang.Class({
|
||||
|
||||
this.actor.style_class = 'grid-search-result';
|
||||
|
||||
let content = provider.createResultActor(metaInfo, terms);
|
||||
let content = provider.createResultObject(metaInfo, terms);
|
||||
let dragSource = null;
|
||||
|
||||
if (content == null) {
|
||||
content = new St.Bin();
|
||||
let actor = new St.Bin();
|
||||
let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
|
||||
{ createIcon: this.metaInfo['createIcon'] });
|
||||
content.set_child(icon.actor);
|
||||
content.label_actor = icon.label;
|
||||
actor.set_child(icon.actor);
|
||||
actor.label_actor = icon.label;
|
||||
dragSource = icon.icon;
|
||||
content = { actor: actor, icon: icon };
|
||||
} else {
|
||||
if (content._delegate && content._delegate.getDragActorSource)
|
||||
dragSource = content._delegate.getDragActorSource();
|
||||
}
|
||||
|
||||
this.actor.set_child(content);
|
||||
this.actor.label_actor = content.label_actor;
|
||||
this.actor.set_child(content.actor);
|
||||
this.actor.label_actor = content.actor.label_actor;
|
||||
this.icon = content.icon;
|
||||
|
||||
let draggable = DND.makeDraggable(this.actor);
|
||||
draggable.connect('drag-begin',
|
||||
@ -327,7 +329,7 @@ const GridSearchResults = new Lang.Class({
|
||||
for (let i = 0; i < metas.length; i++) {
|
||||
let display = new GridSearchResult(this.provider, metas[i], this._terms);
|
||||
display.actor.connect('key-focus-in', Lang.bind(this, this._keyFocusIn));
|
||||
this._grid.addItem(display.actor);
|
||||
this._grid.addItem(display);
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user