Merge pull request #48 from mengzhuo/master

Hide Indicator if offline
yahoo_weather
Christian Louis Gabriel METZLER 12 years ago
commit 734987b281
  1. 16
      src/extension.js

@ -11,7 +11,8 @@
* Simon Legner <Simon.Legner@gmail.com>, * Simon Legner <Simon.Legner@gmail.com>,
* Christian METZLER <neroth@xeked.com>, * Christian METZLER <neroth@xeked.com>,
* Mark Benjamin weather.gnome.Markie1@dfgh.net, * Mark Benjamin weather.gnome.Markie1@dfgh.net,
* Mattia Meneguzzo odysseus@fedoraproject.org * Mattia Meneguzzo odysseus@fedoraproject.org,
* Meng Zhuo <mengzhuo1203+spam@gmail.com>
* *
* *
* This file is part of gnome-shell-extension-weather. * This file is part of gnome-shell-extension-weather.
@ -42,6 +43,7 @@ const Soup = imports.gi.Soup;
const Shell = imports.gi.Shell; const Shell = imports.gi.Shell;
const St = imports.gi.St; const St = imports.gi.St;
const Util = imports.misc.util; const Util = imports.misc.util;
const NMClient = imports.gi.NMClient;
const _ = Gettext.gettext; const _ = Gettext.gettext;
const Main = imports.ui.main; const Main = imports.ui.main;
@ -119,6 +121,9 @@ WeatherMenuButton.prototype = {
_init: function() { _init: function() {
// Load settings // Load settings
this.loadConfig(); this.loadConfig();
//Load Network status
this._nmClient = NMClient.Client.new();
// Label // Label
this._weatherInfo = new St.Label({ text: _('...') }); this._weatherInfo = new St.Label({ text: _('...') });
@ -486,6 +491,7 @@ WeatherMenuButton.prototype = {
{ {
let that = this; let that = this;
let cities = this._cities; let cities = this._cities;
cities = cities.split(" && "); cities = cities.split(" && ");
if(cities && typeof cities == "string") if(cities && typeof cities == "string")
cities = [cities]; cities = [cities];
@ -870,6 +876,14 @@ WeatherMenuButton.prototype = {
}, },
refreshWeather: function(recurse) { refreshWeather: function(recurse) {
if (this._nmClient.get_active_connections() == null){
this.actor.hide();
}
else{
this.actor.show();
}
if(!this.extractWoeid(this._city)) if(!this.extractWoeid(this._city))
{ {
this.updateCities(); this.updateCities();

Loading…
Cancel
Save