@ -65,16 +65,17 @@ WeatherMenuButton.prototype = {
_ _proto _ _ : PanelMenu . Button . prototype ,
_init : function ( ) {
// Load Settings
this . _settings = new Gio . Settings ( { schema : WEATHER _SETTINGS _SCHEMA } ) ;
if ( this . _settings == null ) {
//check for the schemas before loading
if ( ! this . has _schema ( WEATHER _SETTINGS _SCHEMA ) ) {
global . log ( 'xml weather schemas not installed' ) ;
return ;
}
// Load Settings
this . _settings = new Gio . Settings ( { schema : WEATHER _SETTINGS _SCHEMA } ) ;
this . _units = this . _settings . get _enum ( WEATHER _UNIT _KEY ) ;
this . _city = this . _settings . get _string ( WEATHER _CITY _KEY ) ;
this . _woeid = this . _settings . get _string ( WEATHER _WOEID _KEY ) ;
// Panel icon
this . _weatherIcon = new St . Icon ( {
icon _type : St . IconType . SYMBOLIC ,
@ -132,6 +133,16 @@ WeatherMenuButton.prototype = {
} ,
has _schema : function ( schema ) {
let schemas = Gio . Settings . list _schemas ( ) ;
for ( let i = 0 ; i < schemas . length ; i ++ ) {
if ( schemas [ i ] == schema ) {
return true ;
}
}
return false ;
} ,
unit _to _string : function ( unit ) {
if ( unit == WeatherUnits . FAHRENHEIT ) {
return 'f' ;