[gnome-shell] workspacesView: Handle reordering of workspaces



commit d0da96ad299680f9871ffa502bf75b871e5dc055
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Jul 9 14:03:22 2019 +0200

    workspacesView: 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/workspacesView.js | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 5fd9b1508..7aa976ef3 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -101,6 +101,14 @@ var WorkspacesView = class extends WorkspacesViewBase {
         this._updateWorkspacesId =
             workspaceManager.connect('notify::n-workspaces',
                                      this._updateWorkspaces.bind(this));
+        this._reorderWorkspacesId =
+            workspaceManager.connect('workspaces-reordered', () => {
+                this._workspaces.sort((a, b) => {
+                    return a.metaWorkspace.index() - b.metaWorkspace.index();
+                });
+                this._updateWorkspaceActors(false);
+            });
+
 
         this._overviewShownId =
             Main.overview.connect('shown', () => {
@@ -287,6 +295,7 @@ var WorkspacesView = class extends WorkspacesViewBase {
         global.window_manager.disconnect(this._switchWorkspaceNotifyId);
         let workspaceManager = global.workspace_manager;
         workspaceManager.disconnect(this._updateWorkspacesId);
+        workspaceManager.disconnect(this._reorderWorkspacesId);
     }
 
     startSwipeScroll() {


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