cleanup: Use type-safe comparisons

We have been using type-safe comparisons in new code for quite a while
now, however old code has only been adapted slowly.

Change all the remaining bits to get rid of another legacy style
difference.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
This commit is contained in:
Florian Müllner
2023-08-07 02:51:19 +02:00
committed by Marge Bot
parent 9a3913d4a0
commit a42f7c2384
94 changed files with 847 additions and 845 deletions

View File

@ -95,7 +95,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
if (!window.allows_resize())
item.setSensitive(false);
if (!window.titlebar_is_onscreen() && type != Meta.WindowType.DOCK && type != Meta.WindowType.DESKTOP) {
if (!window.titlebar_is_onscreen() && type !== Meta.WindowType.DOCK && type !== Meta.WindowType.DESKTOP) {
this.addAction(_('Move Titlebar Onscreen'), () => {
window.shove_titlebar_onscreen();
});
@ -109,10 +109,10 @@ export class WindowMenu extends PopupMenu.PopupMenu {
});
if (window.is_above())
item.setOrnament(PopupMenu.Ornament.CHECK);
if (window.get_maximized() == Meta.MaximizeFlags.BOTH ||
type == Meta.WindowType.DOCK ||
type == Meta.WindowType.DESKTOP ||
type == Meta.WindowType.SPLASHSCREEN)
if (window.get_maximized() === Meta.MaximizeFlags.BOTH ||
type === Meta.WindowType.DOCK ||
type === Meta.WindowType.DESKTOP ||
type === Meta.WindowType.SPLASHSCREEN)
item.setSensitive(false);
if (Main.sessionMode.hasWorkspaces &&
@ -133,25 +133,25 @@ export class WindowMenu extends PopupMenu.PopupMenu {
if (!isSticky) {
let workspace = window.get_workspace();
if (workspace != workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
if (workspace !== workspace.get_neighbor(Meta.MotionDirection.LEFT)) {
this.addAction(_('Move to Workspace Left'), () => {
let dir = Meta.MotionDirection.LEFT;
window.change_workspace(workspace.get_neighbor(dir));
});
}
if (workspace != workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
if (workspace !== workspace.get_neighbor(Meta.MotionDirection.RIGHT)) {
this.addAction(_('Move to Workspace Right'), () => {
let dir = Meta.MotionDirection.RIGHT;
window.change_workspace(workspace.get_neighbor(dir));
});
}
if (workspace != workspace.get_neighbor(Meta.MotionDirection.UP)) {
if (workspace !== workspace.get_neighbor(Meta.MotionDirection.UP)) {
this.addAction(_('Move to Workspace Up'), () => {
let dir = Meta.MotionDirection.UP;
window.change_workspace(workspace.get_neighbor(dir));
});
}
if (workspace != workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
if (workspace !== workspace.get_neighbor(Meta.MotionDirection.DOWN)) {
this.addAction(_('Move to Workspace Down'), () => {
let dir = Meta.MotionDirection.DOWN;
window.change_workspace(workspace.get_neighbor(dir));
@ -169,7 +169,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
let dir = Meta.DisplayDirection.UP;
let upMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
if (upMonitorIndex != -1) {
if (upMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Up'), () => {
window.move_to_monitor(upMonitorIndex);
});
@ -178,7 +178,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
dir = Meta.DisplayDirection.DOWN;
let downMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
if (downMonitorIndex != -1) {
if (downMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Down'), () => {
window.move_to_monitor(downMonitorIndex);
});
@ -187,7 +187,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
dir = Meta.DisplayDirection.LEFT;
let leftMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
if (leftMonitorIndex != -1) {
if (leftMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Left'), () => {
window.move_to_monitor(leftMonitorIndex);
});
@ -196,7 +196,7 @@ export class WindowMenu extends PopupMenu.PopupMenu {
dir = Meta.DisplayDirection.RIGHT;
let rightMonitorIndex =
display.get_monitor_neighbor_index(monitorIndex, dir);
if (rightMonitorIndex != -1) {
if (rightMonitorIndex !== -1) {
this.addAction(_('Move to Monitor Right'), () => {
window.move_to_monitor(rightMonitorIndex);
});
@ -228,7 +228,7 @@ export class WindowMenuManager {
if (!Main.sessionMode.hasWmMenus)
return;
if (type != Meta.WindowMenuType.WM)
if (type !== Meta.WindowMenuType.WM)
throw new Error('Unsupported window menu type');
let menu = new WindowMenu(window, this._sourceActor);