From 65831f783ec3d0f13553d3c4534772a585cf4009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 21 Mar 2022 16:44:24 +0100 Subject: [PATCH] Js: Use new :icon-name property Now that we have the new convenience property, apply it to all icon-only buttons. Part-of: --- .../gnome-shell-sass/widgets/_ibus-popup.scss | 7 +++++-- .../widgets/_looking-glass.scss | 2 ++ .../widgets/_message-list.scss | 4 ++++ js/gdm/authPrompt.js | 2 +- js/gdm/loginDialog.js | 3 +-- js/ui/appDisplay.js | 5 +---- js/ui/calendar.js | 4 ++-- js/ui/ibusCandidatePopup.js | 10 ++++------ js/ui/lookingGlass.js | 20 +++++++------------ js/ui/messageList.js | 10 +++------- js/ui/mpris.js | 2 +- js/ui/screenshot.js | 8 ++++---- js/ui/unlockDialog.js | 2 +- js/ui/windowPreview.js | 2 +- 14 files changed, 37 insertions(+), 44 deletions(-) diff --git a/data/theme/gnome-shell-sass/widgets/_ibus-popup.scss b/data/theme/gnome-shell-sass/widgets/_ibus-popup.scss index 28f89f336..8cbaa9521 100644 --- a/data/theme/gnome-shell-sass/widgets/_ibus-popup.scss +++ b/data/theme/gnome-shell-sass/widgets/_ibus-popup.scss @@ -29,8 +29,11 @@ .horizontal & { padding-left: $base_padding*2; } } -.candidate-page-button { padding: $base_padding;} +.candidate-page-button { + padding: $base_padding; + + & StIcon { icon-size: $base_icon_size; } +} .candidate-page-button-previous { border-radius: $base_border_radius 0px 0px $base_border_radius; border-right-width: 0;box-shadow: none;} .candidate-page-button-next { border-radius: 0px $base_border_radius $base_border_radius 0px;box-shadow: none;} -.candidate-page-button-icon { icon-size: $base_icon_size; } diff --git a/data/theme/gnome-shell-sass/widgets/_looking-glass.scss b/data/theme/gnome-shell-sass/widgets/_looking-glass.scss index 8639889e3..146cc29c5 100644 --- a/data/theme/gnome-shell-sass/widgets/_looking-glass.scss +++ b/data/theme/gnome-shell-sass/widgets/_looking-glass.scss @@ -79,6 +79,8 @@ color: $insensitive_fg_color; &:hover { color: lighten($insensitive_fg_color, 20%); } &:active { color: darken($insensitive_fg_color, 20%); } + + & StIcon { icon-size: 12px; } } } diff --git a/data/theme/gnome-shell-sass/widgets/_message-list.scss b/data/theme/gnome-shell-sass/widgets/_message-list.scss index 7f93e817d..5196661c1 100644 --- a/data/theme/gnome-shell-sass/widgets/_message-list.scss +++ b/data/theme/gnome-shell-sass/widgets/_message-list.scss @@ -123,6 +123,8 @@ margin: 1px; &:hover {background-color: transparentize($fg_color, 0.8);} &:active {background-color: transparentize($fg_color, 0.9);} + + & StIcon { icon-size: $base_icon_size; } } // body @@ -157,6 +159,8 @@ // fix margin for last button &:last-child:ltr { margin-right: $base_margin*3; } &:last-child:rtl { margin-left: $base_margin*3; } + + & StIcon { icon-size: $base_icon_size; } } // album-art diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js index f9673468f..4623c1e7c 100644 --- a/js/gdm/authPrompt.js +++ b/js/gdm/authPrompt.js @@ -147,7 +147,7 @@ var AuthPrompt = GObject.registerClass({ can_focus: this._hasCancelButton, x_align: Clutter.ActorAlign.START, y_align: Clutter.ActorAlign.CENTER, - child: new St.Icon({ icon_name: 'go-previous-symbolic' }), + icon_name: 'go-previous-symbolic', }); if (this._hasCancelButton) this.cancelButton.connect('clicked', () => this.cancel()); diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index bead5c8e3..573a4b106 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -308,9 +308,9 @@ var SessionMenuButton = GObject.registerClass({ Signals: { 'session-activated': { param_types: [GObject.TYPE_STRING] } }, }, class SessionMenuButton extends St.Bin { _init() { - let gearIcon = new St.Icon({ icon_name: 'emblem-system-symbolic' }); let button = new St.Button({ style_class: 'modal-dialog-button button login-dialog-session-list-button', + icon_name: 'emblem-system-symbolic', reactive: true, track_hover: true, can_focus: true, @@ -318,7 +318,6 @@ var SessionMenuButton = GObject.registerClass({ accessible_role: Atk.Role.MENU, x_align: Clutter.ActorAlign.CENTER, y_align: Clutter.ActorAlign.CENTER, - child: gearIcon, }); super._init({ child: button }); diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index dd75a09ed..cf76732e9 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -2665,10 +2665,7 @@ var AppFolderDialog = GObject.registerClass({ can_focus: true, x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.CENTER, - child: new St.Icon({ - icon_name: 'document-edit-symbolic', - icon_size: 16, - }), + icon_name: 'document-edit-symbolic', }); this._editButton.connect('notify::checked', () => { diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 5741faa81..f0b8c97f5 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -469,10 +469,10 @@ var Calendar = GObject.registerClass({ this._backButton = new St.Button({ style_class: 'calendar-change-month-back pager-button', + icon_name: 'pan-start-symbolic', accessible_name: _('Previous month'), can_focus: true, }); - this._backButton.add_actor(new St.Icon({ icon_name: 'pan-start-symbolic' })); this._topBox.add(this._backButton); this._backButton.connect('clicked', this._onPrevMonthButtonClicked.bind(this)); @@ -487,10 +487,10 @@ var Calendar = GObject.registerClass({ this._forwardButton = new St.Button({ style_class: 'calendar-change-month-forward pager-button', + icon_name: 'pan-end-symbolic', accessible_name: _('Next month'), can_focus: true, }); - this._forwardButton.add_actor(new St.Icon({ icon_name: 'pan-end-symbolic' })); this._topBox.add(this._forwardButton); this._forwardButton.connect('clicked', this._onNextMonthButtonClicked.bind(this)); diff --git a/js/ui/ibusCandidatePopup.js b/js/ui/ibusCandidatePopup.js index 22bff9f9e..c57e289cb 100644 --- a/js/ui/ibusCandidatePopup.js +++ b/js/ui/ibusCandidatePopup.js @@ -59,14 +59,12 @@ var CandidateArea = GObject.registerClass({ style_class: 'candidate-page-button candidate-page-button-previous button', x_expand: true, }); - this._previousButton.child = new St.Icon({ style_class: 'candidate-page-button-icon' }); this._buttonBox.add_child(this._previousButton); this._nextButton = new St.Button({ style_class: 'candidate-page-button candidate-page-button-next button', x_expand: true, }); - this._nextButton.child = new St.Icon({ style_class: 'candidate-page-button-icon' }); this._buttonBox.add_child(this._nextButton); this.add(this._buttonBox); @@ -104,14 +102,14 @@ var CandidateArea = GObject.registerClass({ this.vertical = false; this.remove_style_class_name('vertical'); this.add_style_class_name('horizontal'); - this._previousButton.child.icon_name = 'go-previous-symbolic'; - this._nextButton.child.icon_name = 'go-next-symbolic'; + this._previousButton.icon_name = 'go-previous-symbolic'; + this._nextButton.icon_name = 'go-next-symbolic'; } else { // VERTICAL || SYSTEM this.vertical = true; this.add_style_class_name('vertical'); this.remove_style_class_name('horizontal'); - this._previousButton.child.icon_name = 'go-up-symbolic'; - this._nextButton.child.icon_name = 'go-down-symbolic'; + this._previousButton.icon_name = 'go-up-symbolic'; + this._nextButton.icon_name = 'go-down-symbolic'; } } diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index c7bf483e4..46004f406 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -421,8 +421,10 @@ class ObjInspector extends St.ScrollView { hbox.add(button); } - button = new St.Button({ style_class: 'window-close' }); - button.add_actor(new St.Icon({ icon_name: 'window-close-symbolic' })); + button = new St.Button({ + style_class: 'window-close', + icon_name: 'window-close-symbolic', + }); button.connect('clicked', this.close.bind(this)); hbox.add(button); if (typeof obj == typeof {}) { @@ -884,11 +886,7 @@ var ActorLink = GObject.registerClass({ }); const inspectButton = new St.Button({ - child: new St.Icon({ - icon_name: 'insert-object-symbolic', - icon_size: 12, - y_align: Clutter.ActorAlign.CENTER, - }), + icon_name: 'insert-object-symbolic', reactive: true, x_expand: true, x_align: Clutter.ActorAlign.START, @@ -1304,9 +1302,7 @@ class LookingGlass extends St.BoxLayout { this.add_actor(toolbar); const inspectButton = new St.Button({ style_class: 'lg-toolbar-button', - child: new St.Icon({ - icon_name: 'find-location-symbolic', - }), + icon_name: 'find-location-symbolic', }); toolbar.add_actor(inspectButton); inspectButton.connect('clicked', () => { @@ -1324,9 +1320,7 @@ class LookingGlass extends St.BoxLayout { const gcButton = new St.Button({ style_class: 'lg-toolbar-button', - child: new St.Icon({ - icon_name: 'user-trash-full-symbolic', - }), + icon_name: 'user-trash-full-symbolic', }); toolbar.add_actor(gcButton); gcButton.connect('clicked', () => { diff --git a/js/ui/messageList.js b/js/ui/messageList.js index 99c544d01..f4e43f7ae 100644 --- a/js/ui/messageList.js +++ b/js/ui/messageList.js @@ -362,14 +362,11 @@ var Message = GObject.registerClass({ }); titleBox.add_actor(this._secondaryBin); - const closeIcon = new St.Icon({ - icon_name: 'window-close-symbolic', - icon_size: 16, - }); this._closeButton = new St.Button({ style_class: 'message-close-button', - child: closeIcon, opacity: 0, + icon_name: 'window-close-symbolic', y_align: Clutter.ActorAlign.CENTER, + opacity: 0, }); titleBox.add_actor(this._closeButton); @@ -438,10 +435,9 @@ var Message = GObject.registerClass({ } addMediaControl(iconName, callback) { - let icon = new St.Icon({ icon_name: iconName, icon_size: 16 }); const button = new St.Button({ style_class: 'message-media-control', - child: icon, + iconName, }); button.connect('clicked', callback); this._mediaControls.add_actor(button); diff --git a/js/ui/mpris.js b/js/ui/mpris.js index 232e172cd..171424769 100644 --- a/js/ui/mpris.js +++ b/js/ui/mpris.js @@ -37,7 +37,7 @@ class MediaMessage extends MessageList.Message { this._player.previous(); }); - this._playPauseButton = this.addMediaControl(null, + this._playPauseButton = this.addMediaControl('', () => { this._player.playPause(); }); diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 33ea6e85b..f30884c57 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -1091,7 +1091,7 @@ var ScreenshotUI = GObject.registerClass({ this._closeButton = new St.Button({ style_class: 'screenshot-ui-close-button', - child: new St.Icon({ icon_name: 'preview-close-symbolic' }), + icon_name: 'preview-close-symbolic', }); this._closeButton.add_constraint(new Clutter.BindConstraint({ source: this._panel, @@ -1203,19 +1203,19 @@ var ScreenshotUI = GObject.registerClass({ this._shotButton = new St.Button({ style_class: 'screenshot-ui-shot-cast-button', + icon_name: 'camera-photo-symbolic', checked: true, }); - this._shotButton.set_child(new St.Icon({ icon_name: 'camera-photo-symbolic' })); this._shotButton.connect('notify::checked', this._onShotButtonToggled.bind(this)); this._shotCastContainer.add_child(this._shotButton); this._castButton = new St.Button({ style_class: 'screenshot-ui-shot-cast-button', + icon_name: 'camera-web-symbolic', toggle_mode: true, visible: Config.HAVE_RECORDER, }); - this._castButton.set_child(new St.Icon({ icon_name: 'camera-web-symbolic' })); this._castButton.connect('notify::checked', this._onCastButtonToggled.bind(this)); this._shotCastContainer.add_child(this._castButton); @@ -1254,9 +1254,9 @@ var ScreenshotUI = GObject.registerClass({ this._showPointerButton = new St.Button({ style_class: 'screenshot-ui-show-pointer-button', + icon_name: 'screenshot-ui-show-pointer-symbolic', toggle_mode: true, }); - this._showPointerButton.set_child(new St.Icon({ icon_name: 'screenshot-ui-show-pointer-symbolic' })); this._showPointerButtonContainer.add_child(this._showPointerButton); this.add_child(new Tooltip(this._showPointerButton, { diff --git a/js/ui/unlockDialog.js b/js/ui/unlockDialog.js index dd13e312b..bf81343b9 100644 --- a/js/ui/unlockDialog.js +++ b/js/ui/unlockDialog.js @@ -566,7 +566,7 @@ var UnlockDialog = GObject.registerClass({ opacity: 0, x_align: Clutter.ActorAlign.END, y_align: Clutter.ActorAlign.END, - child: new St.Icon({ icon_name: 'system-users-symbolic' }), + icon_name: 'system-users-symbolic', }); this._otherUserButton.set_pivot_point(0.5, 0.5); this._otherUserButton.connect('clicked', this._otherUserClicked.bind(this)); diff --git a/js/ui/windowPreview.js b/js/ui/windowPreview.js index 228189b18..e7e1ed92b 100644 --- a/js/ui/windowPreview.js +++ b/js/ui/windowPreview.js @@ -188,7 +188,7 @@ var WindowPreview = GObject.registerClass({ this._closeButton = new St.Button({ visible: false, style_class: 'window-close', - child: new St.Icon({ icon_name: 'preview-close-symbolic' }), + icon_name: 'preview-close-symbolic', }); this._closeButton.add_constraint(new Clutter.BindConstraint({ source: windowContainer,