[gnome-shell] workspaceThumbnails: Handle reordering of workspaces



commit 68e45eb051ae697c55bd78270e40e40b3b334108
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jul 9 14:26:12 2019 +0200

    workspaceThumbnails: Handle reordering of workspaces
    
    MetaWorkspaceManager gained the ability to reorder workspaces, so make
    sure to pick up the new order when that happens.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/620

 js/ui/workspaceThumbnail.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index eaf2f6947..9edddfa24 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -865,6 +865,13 @@ class ThumbnailsBox extends St.Widget {
         this._nWorkspacesNotifyId =
             workspaceManager.connect('notify::n-workspaces',
                                      this._workspacesChanged.bind(this));
+        this._workspacesReorderedId =
+            workspaceManager.connect('workspaces-reordered', () => {
+                this._thumbnails.sort((a, b) => {
+                    return a.metaWorkspace.index() - b.metaWorkspace.index();
+                });
+                this.queue_relayout();
+            });
         this._syncStackingId =
             Main.overview.connect('windows-restacked',
                                   this._syncStacking.bind(this));
@@ -896,6 +903,11 @@ class ThumbnailsBox extends St.Widget {
             workspaceManager.disconnect(this._nWorkspacesNotifyId);
             this._nWorkspacesNotifyId = 0;
         }
+        if (this._workspacesReorderedId > 0) {
+            let workspaceManager = global.workspace_manager;
+            workspaceManager.disconnect(this._workspacesReorderedId);
+            this._workspacesReorderedId = 0;
+        }
 
         if (this._syncStackingId > 0) {
             Main.overview.disconnect(this._syncStackingId);


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