UI: display preferences as icon in the top right corner

yahoo_weather
simon04 13 years ago
parent c1ea18fd45
commit 4cdda9a19b
  1. 32
      src/extension.js
  2. 3
      src/stylesheet.css

@ -173,16 +173,6 @@ WeatherMenuButton.prototype = {
this.menu.addActor(mainBox);
/* TODO install script via Makefile
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
let item = new PopupMenu.PopupMenuItem(_("Preferences..."));
item.connect('activate', function() {
Util.spawn(["weather-extension-configurator"]);
});
this.menu.addMenuItem(item);
*/
// Items
this.showLoadingUi();
@ -196,6 +186,27 @@ WeatherMenuButton.prototype = {
},
getPreferencesIcon: function() {
let prefIcon = new St.Icon ({
icon_type: this._icon_type,
icon_size: 16,
icon_name: 'system-run'
});
let prefButton = new St.Button({
style_class: 'panel-button'
});
prefButton.connect('clicked', function() {
Util.spawn(["weather-extension-configurator"]);
});
let prefBox = new St.BoxLayout({
style_class: 'weather-config',
vertical: true
});
prefButton.add_actor(prefIcon);
prefBox.add_actor(prefButton);
return prefBox;
},
unit_to_url: function() {
return this._units == WeatherUnits.FAHRENHEIT ? 'f' : 'c';
},
@ -625,6 +636,7 @@ WeatherMenuButton.prototype = {
let xb = new St.BoxLayout();
xb.add_actor(bb);
xb.add_actor(rb);
xb.add_actor(this.getPreferencesIcon());
let box = new St.BoxLayout({
style_class: 'weather-current-iconbox'

@ -46,3 +46,6 @@
font-size: 90%;
}
.weather-config {
padding-right: 10px;
}

Loading…
Cancel
Save