[gnome-shell/gnome-3-34] panel: Update window section items on title changes



commit 03219f745d6d03053693111b22f73bfc9e9beaaa
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 28 12:32:31 2019 +0100

    panel: Update window section items on title changes
    
    We currently only update the windows section when either the focus
    app changes, or when the app's windows change (that is, a window is
    opened or closed). This allows the menu item labels to become stale
    if the window title changes after one of those events (for example
    when switching tabs).
    
    Fix this by updating menu items when the corresponding window
    title changes.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/1830

 js/ui/panel.js | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 54bb481f75..77163a7216 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -170,9 +170,13 @@ class AppMenu extends PopupMenu.PopupMenu {
         let windows = this._app.get_windows();
         windows.forEach(window => {
             let title = window.title || this._app.get_name();
-            this._windowSection.addAction(title, event => {
+            let item = this._windowSection.addAction(title, event => {
                 Main.activateWindow(window, event.get_time());
             });
+            let id = window.connect('notify::title', () => {
+                item.label.text = window.title || this._app.get_name();
+            });
+            item.connect('destroy', () => window.disconnect(id));
         });
     }
 }


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