From 23e8a6e4f7477f43133a52f1598f2f94e3ba1db5 Mon Sep 17 00:00:00 2001 From: Jens Lody Date: Fri, 10 Jan 2020 23:32:04 +0100 Subject: [PATCH] Fix button creation on gnome-shell 3.35. The (private) function _createActionButton does not exist anymore. --- data/stylesheet.css | 19 +++++++++++++++++++ src/extension.js | 27 ++++++++++++++------------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/data/stylesheet.css b/data/stylesheet.css index 07cc58f..b7c08f0 100644 --- a/data/stylesheet.css +++ b/data/stylesheet.css @@ -126,3 +126,22 @@ padding-right: 5px; padding-left: 15px; padding-right: 5px; } + +.openweather-button-action { +-st-icon-style: symbolic; +border-radius: 32px; +margin: 0px; +min-height: 22px; +min-width: 22px; +padding: 10px; +font-size: 100%; +} +.openweather-button-action:hover, +.openweather-button-action:focus { +border: none; +padding: 11px; +} + +.openweather-button-action > StIcon { +icon-size: 16px; +} diff --git a/src/extension.js b/src/extension.js index 3d2c9b3..2b894fa 100644 --- a/src/extension.js +++ b/src/extension.js @@ -698,24 +698,25 @@ class OpenweatherMenuButton extends PanelMenu.Button { this._buttonMenu.remove_style_pseudo_class('active'); } - createButton(iconName, accessibleName) { let button; + button = new St.Button({ + reactive: true, + can_focus: true, + track_hover: true, + accessible_name: accessibleName, + style_class: 'message-list-clear-button button openweather-button-action' + }); + + button.child = new St.Icon({ + icon_name: iconName + }); + if (ExtensionUtils.versionCheck(['3.8'], Config.PACKAGE_VERSION)) { - button = new St.Button({ - reactive: true, - can_focus: true, - track_hover: true, - accessible_name: accessibleName, - style_class: 'popup-menu-item openweather-button' - }); - button.child = new St.Icon({ - icon_name: iconName - }); + button.style_class ='popup-menu-item openweather-button'; button.connect('notify::hover', Lang.bind(this, this._onButtonHoverChanged)); - } else - button = Main.panel.statusArea.aggregateMenu._system._createActionButton(iconName, accessibleName); + } return button; }