|
|
@ -196,26 +196,26 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
let topBox = new St.BoxLayout(); |
|
|
|
let topBox = new St.BoxLayout(); |
|
|
|
topBox.add_actor(this._weatherIcon); |
|
|
|
topBox.add_actor(this._weatherIcon); |
|
|
|
topBox.add_actor(this._weatherInfo); |
|
|
|
topBox.add_actor(this._weatherInfo); |
|
|
|
this.actor.add_actor(topBox); |
|
|
|
this.add_actor(topBox); |
|
|
|
|
|
|
|
|
|
|
|
let dummyBox = new St.BoxLayout(); |
|
|
|
let dummyBox = new St.BoxLayout(); |
|
|
|
this.actor.reparent(dummyBox); |
|
|
|
this.reparent(dummyBox); |
|
|
|
dummyBox.remove_actor(this.actor); |
|
|
|
dummyBox.remove_actor(this); |
|
|
|
dummyBox.destroy(); |
|
|
|
dummyBox.destroy(); |
|
|
|
|
|
|
|
|
|
|
|
let children = null; |
|
|
|
let children = null; |
|
|
|
switch (this._position_in_panel) { |
|
|
|
switch (this._position_in_panel) { |
|
|
|
case WeatherPosition.LEFT: |
|
|
|
case WeatherPosition.LEFT: |
|
|
|
children = Main.panel._leftBox.get_children(); |
|
|
|
children = Main.panel._leftBox.get_children(); |
|
|
|
Main.panel._leftBox.insert_child_at_index(this.actor, children.length); |
|
|
|
Main.panel._leftBox.insert_child_at_index(this, children.length); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WeatherPosition.CENTER: |
|
|
|
case WeatherPosition.CENTER: |
|
|
|
children = Main.panel._centerBox.get_children(); |
|
|
|
children = Main.panel._centerBox.get_children(); |
|
|
|
Main.panel._centerBox.insert_child_at_index(this.actor, children.length); |
|
|
|
Main.panel._centerBox.insert_child_at_index(this, children.length); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WeatherPosition.RIGHT: |
|
|
|
case WeatherPosition.RIGHT: |
|
|
|
children = Main.panel._rightBox.get_children(); |
|
|
|
children = Main.panel._rightBox.get_children(); |
|
|
|
Main.panel._rightBox.insert_child_at_index(this.actor, 0); |
|
|
|
Main.panel._rightBox.insert_child_at_index(this, 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (Main.panel._menus === undefined) |
|
|
|
if (Main.panel._menus === undefined) |
|
|
@ -244,8 +244,8 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
_itemCurrent.addActor(this._currentWeather); |
|
|
|
_itemCurrent.addActor(this._currentWeather); |
|
|
|
_itemFuture.addActor(this._futureWeather); |
|
|
|
_itemFuture.addActor(this._futureWeather); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
_itemCurrent.actor.add_actor(this._currentWeather); |
|
|
|
_itemCurrent.add_actor(this._currentWeather); |
|
|
|
_itemFuture.actor.add_actor(this._futureWeather); |
|
|
|
_itemFuture.add_actor(this._futureWeather); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.menu.addMenuItem(_itemCurrent); |
|
|
|
this.menu.addMenuItem(_itemCurrent); |
|
|
@ -259,7 +259,7 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
this.menu.addMenuItem(item); |
|
|
|
this.menu.addMenuItem(item); |
|
|
|
|
|
|
|
|
|
|
|
this._selectCity = new PopupMenu.PopupSubMenuMenuItem(""); |
|
|
|
this._selectCity = new PopupMenu.PopupSubMenuMenuItem(""); |
|
|
|
this._selectCity.actor.set_height(0); |
|
|
|
this._selectCity.set_height(0); |
|
|
|
this._selectCity._triangle.set_height(0); |
|
|
|
this._selectCity._triangle.set_height(0); |
|
|
|
|
|
|
|
|
|
|
|
this._buttonMenu = new PopupMenu.PopupBaseMenuItem({ |
|
|
|
this._buttonMenu = new PopupMenu.PopupBaseMenuItem({ |
|
|
@ -273,7 +273,7 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
this.menu.addMenuItem(this._selectCity); |
|
|
|
this.menu.addMenuItem(this._selectCity); |
|
|
|
this.rebuildSelectCityItem(); |
|
|
|
this.rebuildSelectCityItem(); |
|
|
|
this._selectCity.menu.connect('open-state-changed', Lang.bind(this, function() { |
|
|
|
this._selectCity.menu.connect('open-state-changed', Lang.bind(this, function() { |
|
|
|
this._selectCity.actor.remove_style_pseudo_class('open'); |
|
|
|
this._selectCity.remove_style_pseudo_class('open'); |
|
|
|
})); |
|
|
|
})); |
|
|
|
|
|
|
|
|
|
|
|
this.rebuildCurrentWeatherUi(); |
|
|
|
this.rebuildCurrentWeatherUi(); |
|
|
@ -655,7 +655,7 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
if (!this._needsColorUpdate) |
|
|
|
if (!this._needsColorUpdate) |
|
|
|
return; |
|
|
|
return; |
|
|
|
this._needsColorUpdate = false; |
|
|
|
this._needsColorUpdate = false; |
|
|
|
let color = this._separatorItem._separator.actor.get_theme_node().get_color('-gradient-end'); |
|
|
|
let color = this._separatorItem._separator.get_theme_node().get_color('-gradient-end'); |
|
|
|
|
|
|
|
|
|
|
|
let alpha = (Math.round(color.alpha / 2.55) / 100); |
|
|
|
let alpha = (Math.round(color.alpha / 2.55) / 100); |
|
|
|
|
|
|
|
|
|
|
@ -668,10 +668,10 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
this._reloadButton.set_style(this._button_border_style); |
|
|
|
this._reloadButton.set_style(this._button_border_style); |
|
|
|
this._prefsButton.set_style(this._button_border_style); |
|
|
|
this._prefsButton.set_style(this._button_border_style); |
|
|
|
|
|
|
|
|
|
|
|
this._buttonMenu.actor.add_style_pseudo_class('active'); |
|
|
|
this._buttonMenu.add_style_pseudo_class('active'); |
|
|
|
color = this._buttonMenu.actor.get_theme_node().get_background_color(); |
|
|
|
color = this._buttonMenu.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._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'); |
|
|
|
this._buttonMenu.remove_style_pseudo_class('active'); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -957,8 +957,8 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
this._buttonMenu.addActor(this._buttonBox); |
|
|
|
this._buttonMenu.addActor(this._buttonBox); |
|
|
|
this._needsColorUpdate = true; |
|
|
|
this._needsColorUpdate = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this._buttonMenu.actor.add_actor(this._buttonBox1); |
|
|
|
this._buttonMenu.add_actor(this._buttonBox1); |
|
|
|
this._buttonMenu.actor.add_actor(this._buttonBox2); |
|
|
|
this._buttonMenu.add_actor(this._buttonBox2); |
|
|
|
} |
|
|
|
} |
|
|
|
this._buttonBox1MinWidth = undefined; |
|
|
|
this._buttonBox1MinWidth = undefined; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -990,9 +990,9 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (cities.length == 1) |
|
|
|
if (cities.length == 1) |
|
|
|
this._selectCity.actor.hide(); |
|
|
|
this._selectCity.hide(); |
|
|
|
else |
|
|
|
else |
|
|
|
this._selectCity.actor.show(); |
|
|
|
this._selectCity.show(); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -1215,13 +1215,13 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
if (this._old_position_in_panel != this._position_in_panel) { |
|
|
|
if (this._old_position_in_panel != this._position_in_panel) { |
|
|
|
switch (this._old_position_in_panel) { |
|
|
|
switch (this._old_position_in_panel) { |
|
|
|
case WeatherPosition.LEFT: |
|
|
|
case WeatherPosition.LEFT: |
|
|
|
Main.panel._leftBox.remove_actor(this.actor); |
|
|
|
Main.panel._leftBox.remove_actor(this); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WeatherPosition.CENTER: |
|
|
|
case WeatherPosition.CENTER: |
|
|
|
Main.panel._centerBox.remove_actor(this.actor); |
|
|
|
Main.panel._centerBox.remove_actor(this); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WeatherPosition.RIGHT: |
|
|
|
case WeatherPosition.RIGHT: |
|
|
|
Main.panel._rightBox.remove_actor(this.actor); |
|
|
|
Main.panel._rightBox.remove_actor(this); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1229,15 +1229,15 @@ const OpenweatherMenuButton = new Lang.Class({ |
|
|
|
switch (this._position_in_panel) { |
|
|
|
switch (this._position_in_panel) { |
|
|
|
case WeatherPosition.LEFT: |
|
|
|
case WeatherPosition.LEFT: |
|
|
|
children = Main.panel._leftBox.get_children(); |
|
|
|
children = Main.panel._leftBox.get_children(); |
|
|
|
Main.panel._leftBox.insert_child_at_index(this.actor, children.length); |
|
|
|
Main.panel._leftBox.insert_child_at_index(this, children.length); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WeatherPosition.CENTER: |
|
|
|
case WeatherPosition.CENTER: |
|
|
|
children = Main.panel._centerBox.get_children(); |
|
|
|
children = Main.panel._centerBox.get_children(); |
|
|
|
Main.panel._centerBox.insert_child_at_index(this.actor, children.length); |
|
|
|
Main.panel._centerBox.insert_child_at_index(this, children.length); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case WeatherPosition.RIGHT: |
|
|
|
case WeatherPosition.RIGHT: |
|
|
|
children = Main.panel._rightBox.get_children(); |
|
|
|
children = Main.panel._rightBox.get_children(); |
|
|
|
Main.panel._rightBox.insert_child_at_index(this.actor, 0); |
|
|
|
Main.panel._rightBox.insert_child_at_index(this, 0); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
this._old_position_in_panel = this._position_in_panel; |
|
|
|
this._old_position_in_panel = this._position_in_panel; |
|
|
|