diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c0ba1fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +Makefile.in.in +configure +config.log +config.status +aclocal.m4 +autom4te.cache/ +po/POTFILES +po/stamp-it +staging/ + +*~ +*.gmo +metadata.json +*.gschema.xml +*.gschema.valid diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..46db7b0 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,4 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +SUBDIRS = src po + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..5df3714 --- /dev/null +++ b/NEWS @@ -0,0 +1,16 @@ +0.4 +=== +- add autotools support + + 0.3 + === +- add translation support + + 0.2 + === +- add yahoo backend +- add symbolic icons + + 0.1 ( + === + first skeleton implementation diff --git a/README b/README new file mode 100644 index 0000000..2c0702b --- /dev/null +++ b/README @@ -0,0 +1,61 @@ +## gnome-shell-extension-weather + +gnome-shell-extension-weather is a simple extension for displaying weather notifications in Gnome Shell. + +Currently, the weather report including forecast for today and tomorrow is fetched from [Yahoo](http://weather.yahoo.com/). + +### Screenshot + +![Screenshot](https://github.com/ecyrbe/gnome-shell-extension-weather/raw/master/data/screenshot.png) + +### Installation + +From the command line +1. ./autogen.sh --prefix="/usr" +2. make +3. sudo make install + +that's it! + +### Configuration + +Gnome extension weather use gsettings to save your configuration +You can modify the temperature unit with the following command + +. gsettings set org.gnome.shell.extensions.weather unit 'celsius' + + or + +. gsettings set org.gnome.shell.extensions.weather unit 'fahrenheit' + +You can specify your location buy using this command, (cf. [WOEID](http://developer.yahoo.com/geo/geoplanet/guide/concepts.html)) + +. gsettings set org.gnome.shell.extensions.weather woeid 'your location' + +Sometimes your woeid location isn't quite right. it's the next major city around. to customise the displayed city you can type : + +. gsettings set org.gnome.shell.extensions.weather city 'your city' + +### Restart Gnome-Shell + +Don't forget to restart Gnome-Shell + +1. Restart Gnome Shell (`[Alt]+[F2]`, `r`) +2. Fork this project as you like + +### Licence + +Copyright (C) 2011 +Ecyrbe , +Timur Kristóf , +Elad Alfassa , +Simon Legner + +This file is part of gnome-shell-extension-weather. + +gnome-shell-extension-weather is free software: you can redistribute it and/or modify it under the terms of the **GNU General Public License as published by the Free Software Foundation, either version 3** of the License, or (at your option) any later version. + +gnome-shell-extension-weather is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with gnome-shell-extension-weather. If not, see . + diff --git a/README.md b/README.md index 33733ea..48e957e 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,67 @@ gnome-shell-extension-weather is a simple extension for displaying weather notif Currently, the weather report including forecast for today and tomorrow is fetched from [Yahoo](http://weather.yahoo.com/). -### Screenshot +### Screenshots -![Screenshot](https://github.com/simon04/gnome-shell-extension-weather/raw/master/screenshot.png) +![Screenshot](https://github.com/ecyrbe/gnome-shell-extension-weather/raw/master/data/screenshot.png) + +And with french translation: + +![Screenshot](https://github.com/ecyrbe/gnome-shell-extension-weather/raw/master/data/screenshot2.png) ### Installation -1. Change `YAHOO_ID` to your location in extension.js (cf. [WOEID](http://developer.yahoo.com/geo/geoplanet/guide/concepts.html)) -2. Put directory `weather@venemo.com/` in `~/.local/share/gnome-shell/extensions/` -3. Restart Gnome Shell (`[Alt]+[F2]`, `r`) -4. Enjoy, contribute, ... +From the command line + +1. ./autogen.sh --prefix="/usr" +2. make +3. sudo make install + +That's it! + +### Configuration + +Gnome extension weather use gsettings to save your configuration. you can use dconf-editor or gsettings from the command line to modify some parameters + +#### Location (cf [WOEID](http://developer.yahoo.com/geo/geoplanet/guide/concepts.html)) + +You can specify your location buy using this command: + +```bash +gsettings set org.gnome.shell.extensions.weather woeid 'your location' +``` + +#### Temperature units (optional, celsius by default) + +You can modify the temperature unit with the following command + +```bash + gsettings set org.gnome.shell.extensions.weather unit 'celsius' + ``` + or + +```bash +gsettings set org.gnome.shell.extensions.weather unit 'fahrenheit' +``` + +#### Displayed location (optional) + +Sometimes your woeid location isn't quite right. it's the next major city around. to customise the displayed city you can type : + +```bash +gsettings set org.gnome.shell.extensions.weather city 'your city' +``` +### Restart Gnome-Shell + +Don't forget to restart Gnome-Shell + +1. Restart Gnome Shell (`[Alt]+[F2]`, `r`) +2. Fork this project as you like ### Licence Copyright (C) 2011 +Ecyrbe , Timur Kristóf , Elad Alfassa , Simon Legner diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..1b9cc5e --- /dev/null +++ b/autogen.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="gnome-shell-extension-weather" + +test -f $srcdir/configure.ac || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level gnome-shell-extensions directory" + exit 1 +} + +which gnome-autogen.sh || { + echo "You need to install gnome-common from GNOME Git (or from" + echo "your OS vendor's package manager)." + exit 1 +} +. gnome-autogen.sh diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 0000000..7e97b48 --- /dev/null +++ b/config/.gitignore @@ -0,0 +1,3 @@ +install-sh +mkinstalldirs +missing diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..f1810d5 --- /dev/null +++ b/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ(2.63) +dnl be carefull, the version needs to be in sync with your gnome shell version +AC_INIT([gnome-shell-extension-weather],[3.0],[https://github.com/ecyrbe/gnome-shell-extension-weather/issues]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([config]) + +AM_INIT_AUTOMAKE([1.10 dist-bzip2 no-dist-gzip foreign tar-ustar]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +GETTEXT_PACKAGE=gnome-shell-extension-weather +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [The prefix for our gettext translation domains.]) +IT_PROG_INTLTOOL(0.26) + +PKG_PROG_PKG_CONFIG([0.22]) + +GLIB_GSETTINGS + +dnl Please keep this sorted alphabetically +AC_CONFIG_FILES([ + Makefile + po/Makefile.in + src/Makefile +]) +AC_OUTPUT diff --git a/screenshot.png b/data/screenshot.png similarity index 100% rename from screenshot.png rename to data/screenshot.png diff --git a/data/screenshot2.png b/data/screenshot2.png new file mode 100644 index 0000000..4293b75 Binary files /dev/null and b/data/screenshot2.png differ diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..9f841b0 --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1 @@ +intltool.m4 diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..1d9ebc4 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1,2 @@ +fr + diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..c9114fb --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,2 @@ +src/extension.js + diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..ce8914c --- /dev/null +++ b/po/fr.po @@ -0,0 +1,260 @@ +# French translations for PACKAGE package +# Traductions françaises du paquet PACKAGE. +# Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Simon Claessens , 2011. +# ecyrbe , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: 3.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-05-27 01:22+0200\n" +"PO-Revision-Date: 2011-05-27 09:44+0200\n" +"Last-Translator: ecyrbe \n" +"Language-Team: Français \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bits\n" +"Plural-Forms: nplurals=2; plural=(n!=1);\n" + +#: extension.js:73 +msgid "..." +msgstr "..." + +#: extension.js:228 +msgid "Tornado" +msgstr "Tornade" + +#: extension.js:230 +msgid "Tropical storm" +msgstr "Tempête tropicale" + +#: extension.js:232 +msgid "Hurricane" +msgstr "Ouragan" + +#: extension.js:234 +msgid "Severe thunderstorms" +msgstr "Orage sévère" + +#: extension.js:236 +msgid "Thunderstorms" +msgstr "Orage" + +#: extension.js:238 +msgid "Mixed rain and snow" +msgstr "Neige et pluie" + +#: extension.js:240 +msgid "Mixed rain and sleet" +msgstr "Grêle et pluie" + +#: extension.js:242 +msgid "Mixed snow and sleet" +msgstr "Neige et Grêle" + +#: extension.js:244 +msgid "Freezing drizzle" +msgstr "Pluie verglaçante" + +#: extension.js:246 +msgid "Drizzle" +msgstr "Pluie fine" + +#: extension.js:248 +msgid "Freezing rain" +msgstr "Pluie verglaçante" + +#: extension.js:250 extension.js:252 +msgid "Showers" +msgstr "Averses" + +#: extension.js:254 +msgid "Snow flurries" +msgstr "Neige" + +#: extension.js:256 +msgid "Light snow showers" +msgstr "Neige" + +#: extension.js:258 +msgid "Blowing snow" +msgstr "Neige" + +#: extension.js:260 +msgid "Snow" +msgstr "Neige" + +#: extension.js:262 +msgid "Hail" +msgstr "Grêle" + +#: extension.js:264 +msgid "Sleet" +msgstr "Grêlons" + +#: extension.js:266 +msgid "Dust" +msgstr "Brouillard" + +#: extension.js:268 +msgid "Foggy" +msgstr "Brouillard" + +#: extension.js:270 +msgid "Haze" +msgstr "Brume" + +#: extension.js:272 +msgid "Smoky" +msgstr "Brouillard" + +#: extension.js:274 +msgid "Blustery" +msgstr "Bourrasques de vent" + +#: extension.js:276 +msgid "Windy" +msgstr "Venteux" + +#: extension.js:278 +msgid "Cold" +msgstr "Froid" + +#: extension.js:280 +msgid "Cloudy" +msgstr "Nuageux" + +#: extension.js:283 +msgid "Mostly cloudy" +msgstr "Nuageux" + +#: extension.js:286 extension.js:312 +msgid "Partly cloudy" +msgstr "Éclaircies" + +#: extension.js:288 +msgid "Clear" +msgstr "Beau" + +#: extension.js:290 +msgid "Sunny" +msgstr "Ensoleillé" + +#: extension.js:293 +msgid "Fair" +msgstr "Beau" + +#: extension.js:295 +msgid "Mixed rain and hail" +msgstr "Pluie et Grêle" + +#: extension.js:297 +msgid "Hot" +msgstr "Chaud" + +#: extension.js:299 +msgid "Isolated thunderstorms" +msgstr "Orageux" + +#: extension.js:302 +msgid "Scattered thunderstorms" +msgstr "Orageux" + +#: extension.js:304 +msgid "Scattered showers" +msgstr "Grosses averses" + +#: extension.js:306 extension.js:310 +msgid "Heavy snow" +msgstr "Tempête de neige" + +#: extension.js:308 +msgid "Scattered snow showers" +msgstr "Tempête de neige" + +#: extension.js:314 +msgid "Thundershowers" +msgstr "Orages" + +#: extension.js:316 +msgid "Snow showers" +msgstr "Tempête de neige" + +#: extension.js:318 +msgid "Isolated thundershowers" +msgstr "Orageux" + +#: extension.js:321 +msgid "Not available" +msgstr "Non disponible" + +#: extension.js:336 +msgid "Monday" +msgstr "Lundi" + +#: extension.js:336 +msgid "Tuesday" +msgstr "Mardi" + +#: extension.js:336 +msgid "Wednesday" +msgstr "Mercredi" + +#: extension.js:336 +msgid "Thursday" +msgstr "Jeudi" + +#: extension.js:336 +msgid "Friday" +msgstr "Vendredi" + +#: extension.js:336 +msgid "Saturday" +msgstr "Samedi" + +#: extension.js:336 +msgid "Sunday" +msgstr "Dimanche" + +#: extension.js:392 +msgid "Today" +msgstr "Aujourd'hui" + +#: extension.js:392 +msgid "Tomorrow" +msgstr "Demain" + +#: extension.js:429 +msgid "Loading current weather ..." +msgstr "Chargement de la météo ..." + +#: extension.js:430 +msgid "Loading future weather ..." +msgstr "Chargement des prévisions ..." + +#: extension.js:446 +msgid "Loading ..." +msgstr "Chargement ..." + +#: extension.js:449 +msgid "Please wait" +msgstr "Patientez s'il vous plaît" + +#: extension.js:467 +msgid "Temperature:" +msgstr "Température :" + +#: extension.js:469 +msgid "Humidity:" +msgstr "Humidité :" + +#: extension.js:471 +msgid "Pressure:" +msgstr "Pression :" + +#: extension.js:473 +msgid "Wind:" +msgstr "Vent :" diff --git a/po/gnome-shell-extension-weather.pot b/po/gnome-shell-extension-weather.pot new file mode 100644 index 0000000..e0d3384 --- /dev/null +++ b/po/gnome-shell-extension-weather.pot @@ -0,0 +1,258 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2011-05-27 01:22+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: extension.js:73 +msgid "..." +msgstr "" + +#: extension.js:228 +msgid "Tornado" +msgstr "" + +#: extension.js:230 +msgid "Tropical storm" +msgstr "" + +#: extension.js:232 +msgid "Hurricane" +msgstr "" + +#: extension.js:234 +msgid "Severe thunderstorms" +msgstr "" + +#: extension.js:236 +msgid "Thunderstorms" +msgstr "" + +#: extension.js:238 +msgid "Mixed rain and snow" +msgstr "" + +#: extension.js:240 +msgid "Mixed rain and sleet" +msgstr "" + +#: extension.js:242 +msgid "Mixed snow and sleet" +msgstr "" + +#: extension.js:244 +msgid "Freezing drizzle" +msgstr "" + +#: extension.js:246 +msgid "Drizzle" +msgstr "" + +#: extension.js:248 +msgid "Freezing rain" +msgstr "" + +#: extension.js:250 extension.js:252 +msgid "Showers" +msgstr "" + +#: extension.js:254 +msgid "Snow flurries" +msgstr "" + +#: extension.js:256 +msgid "Light snow showers" +msgstr "" + +#: extension.js:258 +msgid "Blowing snow" +msgstr "" + +#: extension.js:260 +msgid "Snow" +msgstr "" + +#: extension.js:262 +msgid "Hail" +msgstr "" + +#: extension.js:264 +msgid "Sleet" +msgstr "" + +#: extension.js:266 +msgid "Dust" +msgstr "" + +#: extension.js:268 +msgid "Foggy" +msgstr "" + +#: extension.js:270 +msgid "Haze" +msgstr "" + +#: extension.js:272 +msgid "Smoky" +msgstr "" + +#: extension.js:274 +msgid "Blustery" +msgstr "" + +#: extension.js:276 +msgid "Windy" +msgstr "" + +#: extension.js:278 +msgid "Cold" +msgstr "" + +#: extension.js:280 +msgid "Cloudy" +msgstr "" + +#: extension.js:283 +msgid "Mostly cloudy" +msgstr "" + +#: extension.js:286 extension.js:312 +msgid "Partly cloudy" +msgstr "" + +#: extension.js:288 +msgid "Clear" +msgstr "" + +#: extension.js:290 +msgid "Sunny" +msgstr "" + +#: extension.js:293 +msgid "Fair" +msgstr "" + +#: extension.js:295 +msgid "Mixed rain and hail" +msgstr "" + +#: extension.js:297 +msgid "Hot" +msgstr "" + +#: extension.js:299 +msgid "Isolated thunderstorms" +msgstr "" + +#: extension.js:302 +msgid "Scattered thunderstorms" +msgstr "" + +#: extension.js:304 +msgid "Scattered showers" +msgstr "" + +#: extension.js:306 extension.js:310 +msgid "Heavy snow" +msgstr "" + +#: extension.js:308 +msgid "Scattered snow showers" +msgstr "" + +#: extension.js:314 +msgid "Thundershowers" +msgstr "" + +#: extension.js:316 +msgid "Snow showers" +msgstr "" + +#: extension.js:318 +msgid "Isolated thundershowers" +msgstr "" + +#: extension.js:321 +msgid "Not available" +msgstr "" + +#: extension.js:336 +msgid "Monday" +msgstr "" + +#: extension.js:336 +msgid "Tuesday" +msgstr "" + +#: extension.js:336 +msgid "Wednesday" +msgstr "" + +#: extension.js:336 +msgid "Thursday" +msgstr "" + +#: extension.js:336 +msgid "Friday" +msgstr "" + +#: extension.js:336 +msgid "Saturday" +msgstr "" + +#: extension.js:336 +msgid "Sunday" +msgstr "" + +#: extension.js:392 +msgid "Today" +msgstr "" + +#: extension.js:392 +msgid "Tomorrow" +msgstr "" + +#: extension.js:429 +msgid "Loading current weather ..." +msgstr "" + +#: extension.js:430 +msgid "Loading future weather ..." +msgstr "" + +#: extension.js:446 +msgid "Loading ..." +msgstr "" + +#: extension.js:449 +msgid "Please wait" +msgstr "" + +#: extension.js:467 +msgid "Temperature:" +msgstr "" + +#: extension.js:469 +msgid "Humidity:" +msgstr "" + +#: extension.js:471 +msgid "Pressure:" +msgstr "" + +#: extension.js:473 +msgid "Wind:" +msgstr "" diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..0ac631b --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,32 @@ +extensionurl = https://github.com/ecyrbe/gnome-shell-extension-weather + +# Change these to modify how installation is performed +topextensiondir = $(datadir)/gnome-shell/extensions + +uuid = weather@gnome-shell-extensions.gnome.org + +extensiondir = $(topextensiondir)/$(uuid) + +dist_extension_DATA = extension.js stylesheet.css +nodist_extension_DATA = metadata.json $(EXTRA_EXTENSION) + +EXTRA_DIST = metadata.json.in + +metadata.json: metadata.json.in $(top_builddir)/config.status + $(AM_V_GEN) sed -e "s|[@]LOCALEDIR@|$(datadir)/locale|" \ + -e "s|[@]uuid@|$(uuid)|" \ + -e "s|[@]shell_current@|$(PACKAGE_VERSION)|" \ + -e "s|[@]url@|$(extensionurl)|" $< > $@ + +CLEANFILES = metadata.json + +gschemas_in = org.gnome.shell.extensions.weather.gschema.xml.in + +@INTLTOOL_XML_NOMERGE_RULE@ + +gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml) + +@GSETTINGS_RULES@ + +CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS) +EXTRA_DIST += $(gschemas_in) diff --git a/weather@venemo.net/extension.js b/src/extension.js similarity index 69% rename from weather@venemo.net/extension.js rename to src/extension.js index 7c4daf7..8a8266a 100644 --- a/weather@venemo.net/extension.js +++ b/src/extension.js @@ -5,7 +5,8 @@ * - On click, gives a popup with details about the weather Copyright (C) 2011 - Timur Kristóf , + ecyrbe , + Timur Kristof , Elad Alfassa , Simon Legner @@ -34,7 +35,7 @@ const Cairo = imports.cairo; const Clutter = imports.gi.Clutter; const Shell = imports.gi.Shell; const St = imports.gi.St; -const Gettext = imports.gettext.domain('gnome-shell'); +const Gettext = imports.gettext.domain('gnome-shell-extension-weather'); const _ = Gettext.gettext; const Json = imports.gi.Json; @@ -44,25 +45,42 @@ const PopupMenu = imports.ui.popupMenu; const Soup = imports.gi.Soup; const Util = imports.misc.util; -const UNITS = 'c'; // Units for temperature (case sensitive). f: Fahrenheit. c: Celsius -const YAHOO_ID = 'AUXX0010'; -const WEATHER_URL = 'http://weather.yahooapis.com/forecastjson?u=' + UNITS + '&p=' + YAHOO_ID; -const FORECAST_URL = 'http://query.yahooapis.com/v1/public/yql?format=json&q=select%20item.forecast%20from%20weather.forecast%20where%20location%3D%22' + YAHOO_ID + '%22%20%20and%20u="' + UNITS + '"'; +// Settings +const WEATHER_SETTINGS_SCHEMA = 'org.gnome.shell.extensions.weather'; +const WEATHER_UNIT_KEY = 'unit'; +const WEATHER_CITY_KEY = 'city'; +const WEATHER_WOEID_KEY = 'woeid'; +// Keep enums in sync with GSettings schemas +const WeatherUnits = { + CELSIUS: 0, + FAHRENHEIT: 1 +}; function WeatherMenuButton() { this._init(); } +function getSettings(schema) { + if (Gio.Settings.list_schemas().indexOf(schema) == -1) + throw _("Schema \"%s\" not found.").format(schema); + return new Gio.Settings({ schema: schema }); +} + WeatherMenuButton.prototype = { __proto__: PanelMenu.Button.prototype, _init: function() { - + // Load Settings + this._settings = getSettings(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.FULLCOLOR, - icon_size: Main.panel.button.get_child().height - 4, + icon_type: St.IconType.SYMBOLIC, + icon_size: Main.panel.button.get_child().height, icon_name: 'view-refresh-symbolic', style_class: 'weather-icon' + (Main.panel.actor.get_direction() == St.TextDirection.RTL ? '-rtl' : '') }); @@ -90,7 +108,7 @@ WeatherMenuButton.prototype = { this._futureWeather = new St.Bin({style_class: 'forecast'/*, x_align: St.Align.START*/}); // Separator (copied from Gnome shell's popupMenu.js) - this._separatorArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' }); + this._separatorArea = new St.DrawingArea({ style_class: 'popup-separator-menu-item' }); this._separatorArea.width = 200; this._separatorArea.connect('repaint', Lang.bind(this, this._onSeparatorAreaRepaint)); @@ -115,6 +133,32 @@ WeatherMenuButton.prototype = { }); }, + + has_schema: function(schema){ + let schemas = Gio.Settings.list_schemas(); + for(let i=0;i0) { + location = this._city; + } + let comment = this.get_weather_condition(weather.get_object_member('condition').get_string_member('code')); let temperature = weather.get_object_member('condition').get_double_member('temperature'); let temperature_unit = '\u00b0' + weather.get_object_member('units').get_string_member('temperature'); let humidity = weather.get_object_member('atmosphere').get_string_member('humidity') + ' %'; @@ -272,21 +431,21 @@ WeatherMenuButton.prototype = { }); // Refresh forecast - this.load_json_async(FORECAST_URL, function(forecast) { + this.load_json_async(this.get_forecast_url(), function(forecast) { - date_string = ['Today', 'Tomorrow']; + date_string = [_('Today'), _('Tomorrow')]; forecast2 = forecast.get_object_member('query').get_object_member('results').get_array_member('channel').get_elements(); for (let i = 0; i <= 1; i++) { let forecastUi = this._forecast[i]; let forecastData = forecast2[i].get_object().get_object_member('item').get_object_member('forecast'); let code = forecastData.get_string_member('code'); - let comment = forecastData.get_string_member('text'); + let comment = this.get_weather_condition(code); let t_low = forecastData.get_string_member('low'); let t_high = forecastData.get_string_member('high'); - forecastUi.Day.text = date_string[i] + ' (' + forecastData.get_string_member('day') + ')'; - forecastUi.Temperature.text = t_low + '\u2013' + t_high + ' ' + UNITS.toUpperCase(); + forecastUi.Day.text = date_string[i] + ' (' + this.get_locale_day(forecastData.get_string_member('day')) + ')'; + forecastUi.Temperature.text = t_low + '\u2013' + t_high + ' \u00b0' + this.unit_to_string(this._units).toUpperCase(); forecastUi.Summary.text = comment; forecastUi.Icon.icon_name = this.get_weather_icon(code); } @@ -320,7 +479,7 @@ WeatherMenuButton.prototype = { // This will hold the icon for the current weather this._currentWeatherIcon = new St.Icon({ - icon_type: St.IconType.FULLCOLOR, //TODO SYMBOLIC not available in 64x64!? + icon_type: St.IconType.SYMBOLIC, icon_size: 64, icon_name: 'view-refresh-symbolic', style_class: 'weather-current-icon' @@ -406,7 +565,7 @@ WeatherMenuButton.prototype = { }, // Copied from Gnome shell's popupMenu.js - _onSeparatorAreaRepaint: function(area) { + _onSeparatorAreaRepaint: function(area){ let cr = area.get_context(); let themeNode = area.get_theme_node(); let [width, height] = area.get_surface_size(); diff --git a/src/metadata.json.in b/src/metadata.json.in new file mode 100644 index 0000000..62db8e7 --- /dev/null +++ b/src/metadata.json.in @@ -0,0 +1,8 @@ +{ +"uuid": "@uuid@", +"name": "Weather indicator", +"description": "Adds weather information menu", +"shell-version": [ "@shell_current@" ], +"localedir": "@LOCALEDIR@", +"url": "@url@" +} diff --git a/src/org.gnome.shell.extensions.weather.gschema.xml.in b/src/org.gnome.shell.extensions.weather.gschema.xml.in new file mode 100644 index 0000000..9014094 --- /dev/null +++ b/src/org.gnome.shell.extensions.weather.gschema.xml.in @@ -0,0 +1,23 @@ + + + + + + + + 'celsius' + <_summary>display units + <_description>Choose the units you want the temperatures. Allowed values are 'celsius' or 'fahrenheit' + + + 'FRXX6724' + <_summary>Forecast Yahoo WOEID + <_description>Set Yahoo id location to retrieve the corresponding forecast informations + + + '' + <_summary>City to be displayed + <_description>Optional, you can override the displayed city provided by the woeid location + + + diff --git a/weather@venemo.net/stylesheet.css b/src/stylesheet.css similarity index 100% rename from weather@venemo.net/stylesheet.css rename to src/stylesheet.css diff --git a/weather@venemo.net/metadata.json b/weather@venemo.net/metadata.json deleted file mode 100644 index fc18559..0000000 --- a/weather@venemo.net/metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"shell-version": ["3.0"], "uuid": "weather@venemo.net", "name": "Weather", "description": "Adds weather information next to the clock."}