[gnome-shell/gbsneto/custom-icon-positions: 35/60] appDisplay: Introduce moveItem API



commit 9d06fdbc65642be6735c2b11264b3d6a4befdcd5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue May 26 10:58:56 2020 -0300

    appDisplay: Introduce moveItem API
    
    This is a simplistic API that basically removes the
    icon from it's old location, and adds it to its new
    location.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

 js/ui/appDisplay.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9f43121f58..d39bd74198 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -470,6 +470,17 @@ var BaseAppView = GObject.registerClass({
         return [item, dragLocation];
     }
 
+    moveItem(item, newPage, newPosition) {
+        const [page, position] = this._grid.getItemPosition(item);
+        if (page === newPage && position === newPosition)
+            return;
+
+        if (this._grid.contains(item))
+            this._removeItem(item);
+
+        this._addItem(item, newPage, newPosition);
+    }
+
     adaptToSize(width, height) {
         let box = new Clutter.ActorBox({
             x2: width,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]