[gnome-shell/gbsneto/custom-icon-positions: 5/30] appDisplay: Introduce moveItem API



commit a7e5a501b8c72c333c4149a92d4c0bb107922086
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 a69e10b9aa..3626eb3913 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -420,6 +420,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 (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]