[gnome-shell/wip/re-search-v2: 3/26] searchDisplay: simplify drag actor source code
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/re-search-v2: 3/26] searchDisplay: simplify drag actor source code
- Date: Mon, 10 Dec 2012 21:02:13 +0000 (UTC)
commit 4441541da66b92792624d1e4723dc4264971d667
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon Dec 10 13:05:58 2012 -0500
searchDisplay: simplify drag actor source code
Make sure this._dragActorSource is always set from _init() to siplify
code.
https://bugzilla.gnome.org/show_bug.cgi?id=681797
js/ui/searchDisplay.js | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js
index 67a674d..6c0ecc1 100644
--- a/js/ui/searchDisplay.js
+++ b/js/ui/searchDisplay.js
@@ -28,9 +28,10 @@ const SearchResult = new Lang.Class({
x_align: St.Align.START,
y_fill: true });
this.actor._delegate = this;
- this._dragActorSource = null;
let content = provider.createResultActor(metaInfo, terms);
+ let dragSource = null;
+
if (content == null) {
content = new St.Bin({ style_class: 'search-result-content',
reactive: true,
@@ -40,11 +41,11 @@ const SearchResult = new Lang.Class({
let icon = new IconGrid.BaseIcon(this.metaInfo['name'],
{ createIcon: this.metaInfo['createIcon'] });
content.set_child(icon.actor);
- this._dragActorSource = icon.icon;
content.label_actor = icon.label;
+ dragSource = icon.icon;
} else {
if (content._delegate && content._delegate.getDragActorSource)
- this._dragActorSource = content._delegate.getDragActorSource();
+ dragSource = content._delegate.getDragActorSource();
}
this._content = content;
this.actor.set_child(content);
@@ -64,6 +65,11 @@ const SearchResult = new Lang.Class({
Lang.bind(this, function() {
Main.overview.endItemDrag(this);
}));
+
+ if (!dragSource)
+ // not exactly right, but alignment problems are hard to notice
+ dragSource = content;
+ this._dragActorSource = dragSource;
},
setSelected: function(selected) {
@@ -83,10 +89,7 @@ const SearchResult = new Lang.Class({
},
getDragActorSource: function() {
- if (this._dragActorSource)
- return this._dragActorSource;
- // not exactly right, but alignment problems are hard to notice
- return this._content;
+ return this._dragActorSource;
},
getDragActor: function(stageX, stageY) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]