appIconMenu: Sync windows section with app menu

Keep the app icon context menu consistent with the app menu, so stop
grouping windows by workspace and add a section heading.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/968
This commit is contained in:
Florian Müllner 2019-02-12 13:37:39 +01:00 committed by Florian Müllner
parent d4763b157d
commit 56a361650c

View File

@ -1707,25 +1707,20 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
w => !w.skip_taskbar w => !w.skip_taskbar
); );
// Display the app windows menu items and the separator between windows if (windows.length > 0)
// of the current desktop and other windows. this.addMenuItem(
let workspaceManager = global.workspace_manager; /* Translators: This is the heading of a list of open windows */
let activeWorkspace = workspaceManager.get_active_workspace(); new PopupMenu.PopupSeparatorMenuItem(_("Open Windows"))
let separatorShown = windows.length > 0 && windows[0].get_workspace() != activeWorkspace; );
for (let i = 0; i < windows.length; i++) { windows.forEach(window => {
let window = windows[i];
if (!separatorShown && window.get_workspace() != activeWorkspace) {
this._appendSeparator();
separatorShown = true;
}
let title = window.title ? window.title let title = window.title ? window.title
: this._source.app.get_name(); : this._source.app.get_name();
let item = this._appendMenuItem(title); let item = this._appendMenuItem(title);
item.connect('activate', () => { item.connect('activate', () => {
this.emit('activate-window', window); this.emit('activate-window', window);
}); });
} });
if (!this._source.app.is_window_backed()) { if (!this._source.app.is_window_backed()) {
this._appendSeparator(); this._appendSeparator();