[gnome-shell] DashDND: Don't allow positioning before or after self
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] DashDND: Don't allow positioning before or after self
- Date: Thu, 6 Jan 2011 13:31:44 +0000 (UTC)
commit cff503922c72ea2a1946873a3e4e5d6cbf6dc409
Author: Adel Gadllah <adel gadllah gmail com>
Date: Thu Jan 6 14:19:44 2011 +0100
DashDND: Don't allow positioning before or after self
Don't allow the icon to be dropped immediately next to
itself.
https://bugzilla.gnome.org/show_bug.cgi?id=637104
js/ui/dash.js | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 39440cf..e3f3063 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -273,7 +273,11 @@ Dash.prototype = {
if (app == null || app.is_transient())
return DND.DragMotionResult.NO_DROP;
- let numFavorites = AppFavorites.getAppFavorites().getFavorites().length;
+ let favorites = AppFavorites.getAppFavorites().getFavorites();
+ let numFavorites = favorites.length;
+
+ let favPos = favorites.indexOf(app);
+
let numChildren = this._box.get_children().length;
let boxHeight = this._box.height;
@@ -291,15 +295,16 @@ Dash.prototype = {
this._dragPlaceholderPos = pos;
if (this._dragPlaceholder)
this._dragPlaceholder.destroy();
+
+ // Don't allow positioning before or after self
+ if (favPos != -1 && (pos == favPos || pos == favPos + 1))
+ return DND.DragMotionResult.CONTINUE;
+
this._dragPlaceholder = new St.Bin({ style_class: 'dash-placeholder' });
this._box.insert_actor(this._dragPlaceholder, pos);
}
- let id = app.get_id();
-
- let favorites = AppFavorites.getAppFavorites().getFavoriteMap();
-
- let srcIsFavorite = (id in favorites);
+ let srcIsFavorite = (favPos != -1);
if (srcIsFavorite)
return DND.DragMotionResult.MOVE_DROP;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]