@ -216,13 +216,8 @@ class OpenweatherMenuButton extends PanelMenu.Button {
reactive : false
} ) ;
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) ) {
_itemCurrent . addActor ( this . _currentWeather ) ;
_itemFuture . addActor ( this . _futureWeather ) ;
} else {
_itemCurrent . actor . add _actor ( this . _currentWeather ) ;
_itemFuture . actor . add _actor ( this . _futureWeather ) ;
}
_itemCurrent . actor . add _actor ( this . _currentWeather ) ;
_itemFuture . actor . add _actor ( this . _futureWeather ) ;
this . menu . addMenuItem ( _itemCurrent ) ;
@ -284,14 +279,6 @@ class OpenweatherMenuButton extends PanelMenu.Button {
this . _checkConnectionState ( ) ;
this . menu . connect ( 'open-state-changed' , Lang . bind ( this , this . recalcLayout ) ) ;
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) ) {
this . _needsColorUpdate = true ;
let context = St . ThemeContext . get _for _stage ( global . stage ) ;
this . _globalThemeChangedId = context . connect ( 'changed' , Lang . bind ( this , function ( ) {
this . _needsColorUpdate = true ;
} ) ) ;
}
}
_onStatusChanged ( status ) {
@ -643,41 +630,6 @@ class OpenweatherMenuButton extends PanelMenu.Button {
return this . _settings . set _string ( OPENWEATHER _CITY _KEY , v ) ;
}
_onButtonHoverChanged ( actor , event ) {
if ( actor . hover ) {
actor . add _style _pseudo _class ( 'hover' ) ;
actor . set _style ( this . _button _background _style ) ;
} else {
actor . remove _style _pseudo _class ( 'hover' ) ;
actor . set _style ( 'background-color:;' ) ;
if ( actor != this . _urlButton )
actor . set _style ( this . _button _border _style ) ;
}
}
_updateButtonColors ( ) {
if ( ! this . _needsColorUpdate )
return ;
this . _needsColorUpdate = false ;
let color = this . _separatorItem . _separator . get _theme _node ( ) . get _color ( '-gradient-end' ) ;
let alpha = ( Math . round ( color . alpha / 2.55 ) / 100 ) ;
if ( color . red > 0 && color . green > 0 && color . blue > 0 )
this . _button _border _style = 'border:1px solid rgb(' + Math . round ( alpha * color . red ) + ',' + Math . round ( alpha * color . green ) + ',' + Math . round ( alpha * color . blue ) + ');' ;
else
this . _button _border _style = 'border:1px solid rgba(' + color . red + ',' + color . green + ',' + color . blue + ',' + alpha + ');' ;
this . _locationButton . set _style ( this . _button _border _style ) ;
this . _reloadButton . set _style ( this . _button _border _style ) ;
this . _prefsButton . set _style ( this . _button _border _style ) ;
this . _buttonMenu . actor . add _style _pseudo _class ( 'active' ) ;
color = this . _buttonMenu . actor . get _theme _node ( ) . get _background _color ( ) ;
this . _button _background _style = 'background-color:rgba(' + color . red + ',' + color . green + ',' + color . blue + ',' + ( Math . round ( color . alpha / 2.55 ) / 100 ) + ');' ;
this . _buttonMenu . actor . remove _style _pseudo _class ( 'active' ) ;
}
createButton ( iconName , accessibleName ) {
let button ;
@ -693,11 +645,6 @@ class OpenweatherMenuButton extends PanelMenu.Button {
icon _name : iconName
} ) ;
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) ) {
button . style _class = 'popup-menu-item openweather-button' ;
button . connect ( 'notify::hover' , Lang . bind ( this , this . _onButtonHoverChanged ) ) ;
}
return button ;
}
@ -898,10 +845,7 @@ class OpenweatherMenuButton extends PanelMenu.Button {
this . _locationButton . set _label ( this . _locationButton . get _accessible _name ( ) ) ;
this . _locationButton . connect ( 'clicked' , Lang . bind ( this , function ( ) {
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) )
this . _selectCity . menu . toggle ( ) ;
else
this . _selectCity . _setOpenState ( ! this . _selectCity . _getOpenState ( ) ) ;
this . _selectCity . _setOpenState ( ! this . _selectCity . _getOpenState ( ) ) ;
} ) ) ;
this . _buttonBox1 = new St . BoxLayout ( {
style _class : 'openweather-button-box'
@ -926,11 +870,6 @@ class OpenweatherMenuButton extends PanelMenu.Button {
this . _urlButton = this . createButton ( '' , _ ( "Weather data provided by:" ) + ( this . _use _text _on _buttons ? "\n" : " " ) + this . weatherProvider ) ;
this . _urlButton . set _label ( this . _urlButton . get _accessible _name ( ) ) ;
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) ) {
this . _urlButton . connect ( 'notify::hover' , Lang . bind ( this , this . _onButtonHoverChanged ) ) ;
this . _urlButton . style _class = 'popup-menu-item' ;
}
this . _urlButton . connect ( 'clicked' , Lang . bind ( this , function ( ) {
this . menu . actor . hide ( ) ;
let url = this . getWeatherProviderURL ( ) ;
@ -951,19 +890,9 @@ class OpenweatherMenuButton extends PanelMenu.Button {
this . _prefsButton . connect ( 'clicked' , Lang . bind ( this , this . _onPreferencesActivate ) ) ;
this . _buttonBox2 . add _actor ( this . _prefsButton ) ;
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) ) {
this . _buttonBox = new St . BoxLayout ( ) ;
this . _buttonBox1 . add _style _class _name ( 'openweather-button-box-38' ) ;
this . _buttonBox2 . add _style _class _name ( 'openweather-button-box-38' ) ;
this . _buttonBox . add _actor ( this . _buttonBox1 ) ;
this . _buttonBox . add _actor ( this . _buttonBox2 ) ;
this . _buttonMenu . actor . add _actor ( this . _buttonBox1 ) ;
this . _buttonMenu . actor . add _actor ( this . _buttonBox2 ) ;
this . _buttonMenu . addActor ( this . _buttonBox ) ;
this . _needsColorUpdate = true ;
} else {
this . _buttonMenu . actor . add _actor ( this . _buttonBox1 ) ;
this . _buttonMenu . actor . add _actor ( this . _buttonBox2 ) ;
}
this . _buttonBox1MinWidth = undefined ;
}
@ -982,10 +911,7 @@ class OpenweatherMenuButton extends PanelMenu.Button {
item = new PopupMenu . PopupMenuItem ( this . extractLocation ( cities [ i ] ) ) ;
item . location = i ;
if ( i == this . _actual _city ) {
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) )
item . setShowDot ( true ) ;
else
item . setOrnament ( PopupMenu . Ornament . DOT ) ;
item . setOrnament ( PopupMenu . Ornament . DOT ) ;
}
this . _selectCity . menu . addMenuItem ( item ) ;
@ -1046,9 +972,6 @@ class OpenweatherMenuButton extends PanelMenu.Button {
recalcLayout ( ) {
if ( ! this . menu . isOpen )
return ;
if ( ExtensionUtils . versionCheck ( [ '3.8' ] , Config . PACKAGE _VERSION ) ) {
this . _updateButtonColors ( ) ;
}
if ( this . _buttonBox1MinWidth === undefined )
this . _buttonBox1MinWidth = this . _buttonBox1 . get _width ( ) ;
this . _buttonBox1 . set _width ( Math . max ( this . _buttonBox1MinWidth , this . _currentWeather . get _width ( ) - this . _buttonBox2 . get _width ( ) ) ) ;