From b9456caeb0bd83f96c390f328fcccf3297c4d2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 20 May 2011 13:57:38 +0200 Subject: [PATCH] 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 --- js/ui/searchDisplay.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index fdf918f3e..bdaa59c8d 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -28,6 +28,7 @@ SearchResult.prototype = { x_align: St.Align.START, y_fill: true }); this.actor._delegate = this; + this._dragActorSource = null; let content = provider.createResultActor(metaInfo, terms); if (content == null) { @@ -37,7 +38,11 @@ SearchResult.prototype = { let icon = new IconGrid.BaseIcon(this.metaInfo['name'], { createIcon: this.metaInfo['createIcon'] }); content.set_child(icon.actor); + this._dragActorSource = icon.icon; this.actor.label_actor = icon.label; + } else { + if (content._delegate && content._delegate.getDragActorSource) + this._dragActorSource = content._delegate.getDragActorSource(); } this._content = content; this.actor.set_child(content); @@ -76,6 +81,8 @@ SearchResult.prototype = { }, getDragActorSource: function() { + if (this._dragActorSource) + return this._dragActorSource; // not exactly right, but alignment problems are hard to notice return this._content; },