Style modification

yahoo_weather
Neroth 13 years ago
parent e5e8e18d4a
commit 64fbf73f7e
  1. 69
      src/extension.js
  2. 16
      src/stylesheet.css

@ -4,11 +4,12 @@
* - Displays a small weather information on the top panel. * - Displays a small weather information on the top panel.
* - On click, gives a popup with details about the weather. * - On click, gives a popup with details about the weather.
* *
* Copyright (C) 2011 * Copyright (C) 2011 - 2012
* ecyrbe <ecyrbe+spam@gmail.com>, * ecyrbe <ecyrbe+spam@gmail.com>,
* Timur Kristof <venemo@msn.com>, * Timur Kristof <venemo@msn.com>,
* Elad Alfassa <elad@fedoraproject.org>, * Elad Alfassa <elad@fedoraproject.org>,
* Simon Legner <Simon.Legner@gmail.com> * Simon Legner <Simon.Legner@gmail.com>,
* Christian METZLER <neroth@xeked.com>
* *
* *
* This file is part of gnome-shell-extension-weather. * This file is part of gnome-shell-extension-weather.
@ -162,30 +163,29 @@ WeatherMenuButton.prototype = {
// Setting button // Setting button
this._settingWeather = new St.Bin({ style_class: 'setting' }); this._settingWeather = new St.Bin({ style_class: 'setting' });
// Separators (copied from Gnome shell's popupMenu.js)
this._separatorArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' });
this._separatorArea.connect('repaint', Lang.bind(this, this._onSeparatorAreaRepaint));
// Putting the popup item together // Putting the popup item together
let mainBox = new St.BoxLayout({ vertical: true }); this.menu.addActor(this._currentWeather);
mainBox.add_actor(this._currentWeather);
mainBox.add_actor(this._separatorArea); let item = new PopupMenu.PopupSeparatorMenuItem();
mainBox.add_actor(this._futureWeather); this.menu.addMenuItem(item);
mainBox.add_actor(this._settingWeather);
this.menu.addActor(mainBox); this.menu.addActor(this._futureWeather);
let item = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(item);
let item = new PopupMenu.PopupMenuItem(_("Weather Settings"));
item.connect('activate', Lang.bind(this, this._onPreferencesActivate));
this.menu.addMenuItem(item);
// Items // Items
this.showLoadingUi(); this.showLoadingUi();
this.rebuildCurrentWeatherUi(); this.rebuildCurrentWeatherUi();
this.rebuildFutureWeatherUi(); this.rebuildFutureWeatherUi();
this.rebuildSettingWeatherUi();
// Show weather // Show weather
Mainloop.timeout_add_seconds(3, Lang.bind(this, function() { this.refreshWeather(true);
this.refreshWeather(true);
}));
}, },
@ -554,11 +554,6 @@ WeatherMenuButton.prototype = {
this._futureWeather.get_child().destroy(); this._futureWeather.get_child().destroy();
}, },
destroySettingWeather: function() {
if (this._settingWeather.get_child() != null)
this._settingWeather.get_child().destroy();
},
showLoadingUi: function() { showLoadingUi: function() {
this.destroyCurrentWeather(); this.destroyCurrentWeather();
this.destroyFutureWeather(); this.destroyFutureWeather();
@ -678,38 +673,6 @@ WeatherMenuButton.prototype = {
} }
},
rebuildSettingWeatherUi: function() {
this.destroySettingWeather();
let item = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(item);
let item = new PopupMenu.PopupMenuItem(_("Weather Settings"));
item.connect('activate', Lang.bind(this, this._onPreferencesActivate));
this.menu.addMenuItem(item);
},
// Copied from Gnome shell's popupMenu.js
_onSeparatorAreaRepaint: function(area) {
let cr = area.get_context();
let themeNode = area.get_theme_node();
let [width, height] = area.get_surface_size();
let margin = themeNode.get_length('-margin-horizontal');
let gradientHeight = themeNode.get_length('-gradient-height');
let startColor = themeNode.get_color('-gradient-start');
let endColor = themeNode.get_color('-gradient-end');
let gradientWidth = (width - margin * 2);
let gradientOffset = (height - gradientHeight) / 2;
let pattern = new Cairo.LinearGradient(margin, gradientOffset, width - margin, gradientOffset + gradientHeight);
pattern.addColorStopRGBA(0, startColor.red / 255, startColor.green / 255, startColor.blue / 255, startColor.alpha / 255);
pattern.addColorStopRGBA(0.5, endColor.red / 255, endColor.green / 255, endColor.blue / 255, endColor.alpha / 255);
pattern.addColorStopRGBA(1, startColor.red / 255, startColor.green / 255, startColor.blue / 255, startColor.alpha / 255);
cr.setSource(pattern);
cr.rectangle(margin, gradientOffset, gradientWidth, gradientHeight);
cr.fill();
} }
}; };

@ -6,15 +6,15 @@
} }
.weather-current-databox { .weather-current-databox {
padding: 0 15px 5px 30px; padding: 0 15px 0px 30px;
} }
.weather-current-icon { .weather-current-icon {
padding: 0px 30px 10px 30px; padding: 0px 30px;
} }
.weather-current-iconbox { .weather-current-iconbox {
padding: 0 20px 0 0; padding-right: 20px;
} }
.weather-icon { .weather-icon {
@ -36,18 +36,10 @@
} }
.weather-forecast-databox { .weather-forecast-databox {
padding: 5px 30px 5px 0; padding-right: 30px;
} }
.weather-forecast-day { .weather-forecast-day {
color: #999999; color: #999999;
font-size: 90%; font-size: 90%;
} }
.weather-setting-button {
padding-top: 500px;
}
.weather-config {
padding-right: 10px;
}

Loading…
Cancel
Save