[gnome-shell/gbsneto/icon-grid-dnd-fixes: 9/11] appDisplay: Allow passing callback to AppFolderDialog.popdown()




commit 84433694afb8d2292aaddcade567e17ed785e31e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Sep 24 16:31:00 2020 -0300

    appDisplay: Allow passing callback to AppFolderDialog.popdown()
    
    Next commit will allow removing icons from the folder, and we want to
    do that effectively after the dialog pops down.
    
    Add an optional callback to AppFolderDialog.popdown().

 js/ui/appDisplay.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 525a864a6d..79373deaeb 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -2092,6 +2092,8 @@ var AppFolderDialog = GObject.registerClass({
         this._sourceMappedId = 0;
         this._popdownTimeoutId = 0;
         this._needsZoomAndFade = false;
+
+        this._popdownCallbacks = [];
     }
 
     _addFolderNameEntry() {
@@ -2296,6 +2298,9 @@ var AppFolderDialog = GObject.registerClass({
                     opacity: 255,
                 });
                 this.hide();
+
+                this._popdownCallbacks.forEach(func => func());
+                this._popdownCallbacks = [];
             },
         });
 
@@ -2476,7 +2481,16 @@ var AppFolderDialog = GObject.registerClass({
         this.emit('open-state-changed', true);
     }
 
-    popdown() {
+    popdown(callback) {
+        // Either call the callback right away, or wait for the zoom out
+        // animation to finish
+        if (callback) {
+            if (this.visible)
+                this._popdownCallbacks.push(callback);
+            else
+                callback();
+        }
+
         if (!this._isOpen)
             return;
 


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