[gnome-shell/gbsneto/custom-icon-positions: 3/28] appDisplay: Introduce moveItem API



commit a8a51579b0b627866353b08b175db7c78cd34484
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 6ae3f0eb5a..cbc0980824 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -456,6 +456,17 @@ var BaseAppView = GObject.registerClass({
         return [targetPage, targetPosition, dragLocation];
     }
 
+    _moveItem(item, newPage, newPosition) {
+        const [page, position] = this._grid.getItemPosition(item);
+        if (page === newPage && position === newPosition)
+            return;
+
+        if (page !== -1 && position !== -1)
+            this._removeItem(item);
+
+        this._addItem(item, newPage, newPosition);
+    }
+
     vfunc_allocate(box) {
         const width = box.get_width();
         const height = box.get_height();


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