search-display: Try harder to use a correct drag actor source

Commit 429f809b7 fixed an exception in getDragActorSource(), but
the returned actor is only an approximation (e.g. in contrast to
the actual drag actor, it includes the label).
Try a bit harder to return the correct actor and only fall back to
the approximation when necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=645990
This commit is contained in:
Florian Müllner 2011-05-20 13:57:38 +02:00
parent 26aa4333a5
commit b9456caeb0

View File

@ -28,6 +28,7 @@ SearchResult.prototype = {
x_align: St.Align.START, x_align: St.Align.START,
y_fill: true }); y_fill: true });
this.actor._delegate = this; this.actor._delegate = this;
this._dragActorSource = null;
let content = provider.createResultActor(metaInfo, terms); let content = provider.createResultActor(metaInfo, terms);
if (content == null) { if (content == null) {
@ -37,7 +38,11 @@ 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._dragActorSource = icon.icon;
this.actor.label_actor = icon.label; this.actor.label_actor = icon.label;
} else {
if (content._delegate && content._delegate.getDragActorSource)
this._dragActorSource = content._delegate.getDragActorSource();
} }
this._content = content; this._content = content;
this.actor.set_child(content); this.actor.set_child(content);
@ -76,6 +81,8 @@ SearchResult.prototype = {
}, },
getDragActorSource: function() { getDragActorSource: function() {
if (this._dragActorSource)
return this._dragActorSource;
// not exactly right, but alignment problems are hard to notice // not exactly right, but alignment problems are hard to notice
return this._content; return this._content;
}, },