appMenu: Update "new-window" item on state changes
Stopped apps can *always* open a new window, so before we start using the menu for non-running apps, make sure to hide the menu item as necessary. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>
This commit is contained in:
parent
321e07c3c6
commit
e3c06e3c77
@ -93,12 +93,19 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
this._updateQuitItem();
|
this._updateQuitItem();
|
||||||
|
this._updateNewWindowItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateQuitItem() {
|
_updateQuitItem() {
|
||||||
this._quitItem.visible = this._app?.state === Shell.AppState.RUNNING;
|
this._quitItem.visible = this._app?.state === Shell.AppState.RUNNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_updateNewWindowItem() {
|
||||||
|
const actions = this._app?.appInfo?.list_actions() ?? [];
|
||||||
|
this._newWindowItem.visible =
|
||||||
|
this._app?.can_open_new_window() && !actions.includes('new-window');
|
||||||
|
}
|
||||||
|
|
||||||
_updateDetailsVisibility() {
|
_updateDetailsVisibility() {
|
||||||
const sw = this._appSystem.lookup_app('org.gnome.Software.desktop');
|
const sw = this._appSystem.lookup_app('org.gnome.Software.desktop');
|
||||||
this._detailsItem.visible = sw !== null;
|
this._detailsItem.visible = sw !== null;
|
||||||
@ -164,9 +171,8 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this._newWindowItem.visible =
|
|
||||||
app && app.can_open_new_window() && !actions.includes('new-window');
|
|
||||||
this._updateQuitItem();
|
this._updateQuitItem();
|
||||||
|
this._updateNewWindowItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
_queueUpdateWindowsSection() {
|
_queueUpdateWindowsSection() {
|
||||||
|
Loading…
Reference in New Issue
Block a user