[Xfce4-commits] <xfce4-weather-plugin:master> Initial support for custom icon themes.

Harald Judt noreply at xfce.org
Sat Nov 10 10:48:01 CET 2012


Updating branch refs/heads/master
         to 01787dffe9470ef806d6b0f5089127de316ef5ed (commit)
       from a0b5e47cbc25b0894f30818ffb4683a72586caac (commit)

commit 01787dffe9470ef806d6b0f5089127de316ef5ed
Author: Harald Judt <h.judt at gmx.at>
Date:   Fri Nov 9 20:57:56 2012 +0100

    Initial support for custom icon themes.
    
    This adds rudimentary support for loading custom icon themes.
    GUI code for easy selection is still missing, but one can
    edit the panel plugin rc file and add a theme_dir entry pointing
    to the (absolute) path of the custom theme.
    
    The liquid icon theme's directory structure has been reorganized
    to reflect the changes and shall serve as a model for new themes.

 README                                             |  135 +++++++++++--
 configure.ac.in                                    |    3 +
 icons/liquid/128/Makefile.am                       |   38 ++++
 icons/liquid/{CLOUD.png => 128/cloud.png}          |  Bin 5647 -> 5647 bytes
 icons/liquid/{FOG.png => 128/fog.png}              |  Bin 7180 -> 7180 bytes
 .../lightcloud-night.png}                          |  Bin 6194 -> 6194 bytes
 .../liquid/{LIGHTCLOUD.png => 128/lightcloud.png}  |  Bin 7701 -> 7701 bytes
 icons/liquid/{LIGHTRAIN.png => 128/lightrain.png}  |  Bin 6799 -> 6799 bytes
 .../lightrainsun-night.png}                        |  Bin 7601 -> 7601 bytes
 .../{LIGHTRAINSUN.png => 128/lightrainsun.png}     |  Bin 8818 -> 8818 bytes
 .../lightrainthunder.png}                          |  Bin 8163 -> 8163 bytes
 .../lightrainthundersun-night.png}                 |  Bin 8612 -> 8612 bytes
 .../lightrainthundersun.png}                       |  Bin 9890 -> 9890 bytes
 icons/liquid/{NODATA.png => 128/nodata.png}        |  Bin 6724 -> 6724 bytes
 .../partlycloud-night.png}                         |  Bin 6922 -> 6922 bytes
 .../{PARTLYCLOUD.png => 128/partlycloud.png}       |  Bin 8427 -> 8427 bytes
 icons/liquid/{RAIN.png => 128/rain.png}            |  Bin 7093 -> 7093 bytes
 .../{RAINTHUNDER.png => 128/rainthunder.png}       |  Bin 8076 -> 8076 bytes
 icons/liquid/{SLEET.png => 128/sleet.png}          |  Bin 8304 -> 8304 bytes
 .../{SLEETSUN-night.png => 128/sleetsun-night.png} |  Bin 8611 -> 8611 bytes
 icons/liquid/{SLEETSUN.png => 128/sleetsun.png}    |  Bin 9357 -> 9357 bytes
 .../sleetsunthunder-night.png}                     |  Bin 9196 -> 9196 bytes
 .../sleetsunthunder.png}                           |  Bin 9679 -> 9679 bytes
 .../{SLEETTHUNDER.png => 128/sleetthunder.png}     |  Bin 9236 -> 9236 bytes
 icons/liquid/{SNOW.png => 128/snow.png}            |  Bin 8632 -> 8632 bytes
 .../{SNOWSUN-night.png => 128/snowsun-night.png}   |  Bin 8672 -> 8672 bytes
 icons/liquid/{SNOWSUN.png => 128/snowsun.png}      |  Bin 9406 -> 9406 bytes
 .../snowsunthunder-night.png}                      |  Bin 9060 -> 9060 bytes
 .../{SNOWSUNTHUNDER.png => 128/snowsunthunder.png} |  Bin 9584 -> 9584 bytes
 .../{SNOWTHUNDER.png => 128/snowthunder.png}       |  Bin 9032 -> 9032 bytes
 icons/liquid/{SUN-night.png => 128/sun-night.png}  |  Bin 5964 -> 5964 bytes
 icons/liquid/{SUN.png => 128/sun.png}              |  Bin 7191 -> 7191 bytes
 icons/liquid/22/Makefile.am                        |   38 ++++
 icons/liquid/22/cloud.png                          |  Bin 0 -> 1228 bytes
 icons/liquid/22/fog.png                            |  Bin 0 -> 1480 bytes
 icons/liquid/22/lightcloud-night.png               |  Bin 0 -> 1424 bytes
 icons/liquid/22/lightcloud.png                     |  Bin 0 -> 1353 bytes
 icons/liquid/22/lightrain.png                      |  Bin 0 -> 1569 bytes
 icons/liquid/22/lightrainsun-night.png             |  Bin 0 -> 1558 bytes
 icons/liquid/22/lightrainsun.png                   |  Bin 0 -> 1572 bytes
 icons/liquid/22/lightrainthunder.png               |  Bin 0 -> 1534 bytes
 icons/liquid/22/lightrainthundersun-night.png      |  Bin 0 -> 1556 bytes
 icons/liquid/22/lightrainthundersun.png            |  Bin 0 -> 1684 bytes
 icons/liquid/22/nodata.png                         |  Bin 0 -> 1251 bytes
 icons/liquid/22/partlycloud-night.png              |  Bin 0 -> 1533 bytes
 icons/liquid/22/partlycloud.png                    |  Bin 0 -> 1410 bytes
 icons/liquid/22/rain.png                           |  Bin 0 -> 1542 bytes
 icons/liquid/22/rainthunder.png                    |  Bin 0 -> 1509 bytes
 icons/liquid/22/sleet.png                          |  Bin 0 -> 1642 bytes
 icons/liquid/22/sleetsun-night.png                 |  Bin 0 -> 1620 bytes
 icons/liquid/22/sleetsun.png                       |  Bin 0 -> 1699 bytes
 icons/liquid/22/sleetsunthunder-night.png          |  Bin 0 -> 1631 bytes
 icons/liquid/22/sleetsunthunder.png                |  Bin 0 -> 1697 bytes
 icons/liquid/22/sleetthunder.png                   |  Bin 0 -> 1671 bytes
 icons/liquid/22/snow.png                           |  Bin 0 -> 1570 bytes
 icons/liquid/22/snowsun-night.png                  |  Bin 0 -> 1530 bytes
 icons/liquid/22/snowsun.png                        |  Bin 0 -> 1609 bytes
 icons/liquid/22/snowsunthunder-night.png           |  Bin 0 -> 1550 bytes
 icons/liquid/22/snowsunthunder.png                 |  Bin 0 -> 1636 bytes
 icons/liquid/22/snowthunder.png                    |  Bin 0 -> 1602 bytes
 icons/liquid/22/sun-night.png                      |  Bin 0 -> 1347 bytes
 icons/liquid/22/sun.png                            |  Bin 0 -> 1350 bytes
 icons/liquid/48/Makefile.am                        |   38 ++++
 icons/liquid/48/cloud.png                          |  Bin 0 -> 3015 bytes
 icons/liquid/48/fog.png                            |  Bin 0 -> 2921 bytes
 icons/liquid/48/lightcloud-night.png               |  Bin 0 -> 3001 bytes
 icons/liquid/48/lightcloud.png                     |  Bin 0 -> 3712 bytes
 icons/liquid/48/lightrain.png                      |  Bin 0 -> 3753 bytes
 icons/liquid/48/lightrainsun-night.png             |  Bin 0 -> 3897 bytes
 icons/liquid/48/lightrainsun.png                   |  Bin 0 -> 4605 bytes
 icons/liquid/48/lightrainthunder.png               |  Bin 0 -> 4042 bytes
 icons/liquid/48/lightrainthundersun-night.png      |  Bin 0 -> 4216 bytes
 icons/liquid/48/lightrainthundersun.png            |  Bin 0 -> 4822 bytes
 icons/liquid/48/nodata.png                         |  Bin 0 -> 3373 bytes
 icons/liquid/48/partlycloud-night.png              |  Bin 0 -> 3406 bytes
 icons/liquid/48/partlycloud.png                    |  Bin 0 -> 4070 bytes
 icons/liquid/48/rain.png                           |  Bin 0 -> 3667 bytes
 icons/liquid/48/rainthunder.png                    |  Bin 0 -> 4034 bytes
 icons/liquid/48/sleet.png                          |  Bin 0 -> 4291 bytes
 icons/liquid/48/sleetsun-night.png                 |  Bin 0 -> 4272 bytes
 icons/liquid/48/sleetsun.png                       |  Bin 0 -> 4605 bytes
 icons/liquid/48/sleetsunthunder-night.png          |  Bin 0 -> 4449 bytes
 icons/liquid/48/sleetsunthunder.png                |  Bin 0 -> 4662 bytes
 icons/liquid/48/sleetthunder.png                   |  Bin 0 -> 4480 bytes
 icons/liquid/48/snow.png                           |  Bin 0 -> 4260 bytes
 icons/liquid/48/snowsun-night.png                  |  Bin 0 -> 4166 bytes
 icons/liquid/48/snowsun.png                        |  Bin 0 -> 4522 bytes
 icons/liquid/48/snowsunthunder-night.png           |  Bin 0 -> 4264 bytes
 icons/liquid/48/snowsunthunder.png                 |  Bin 0 -> 4552 bytes
 icons/liquid/48/snowthunder.png                    |  Bin 0 -> 4340 bytes
 icons/liquid/48/sun-night.png                      |  Bin 0 -> 2847 bytes
 icons/liquid/48/sun.png                            |  Bin 0 -> 3417 bytes
 icons/liquid/Makefile.am                           |   35 +---
 icons/liquid/theme.info                            |    4 +
 panel-plugin/weather-debug.c                       |   25 +++
 panel-plugin/weather-debug.h                       |    3 +
 panel-plugin/weather-icon.c                        |  213 ++++++++++++++++----
 panel-plugin/weather-icon.h                        |   18 ++-
 panel-plugin/weather-summary.c                     |    5 +-
 panel-plugin/weather.c                             |   28 ++-
 panel-plugin/weather.h                             |    4 +
 101 files changed, 490 insertions(+), 97 deletions(-)

diff --git a/README b/README
index a53c522..77a01b2 100644
--- a/README
+++ b/README
@@ -94,14 +94,119 @@ ICON THEMES
 1) Icon theme support
 --------------------------------------------------------------------------
 
-Currently, there is no real icon theme support, but this will be
-worked on in one of the next releases. Until that feature is
-implemented, you can of course replace the liquid weather icons with
-your own, however this will in most cases require root permissions. If
-you want to design your own set, please have a look at the liquid
-theme to get an idea what the icons should look like and at the source
-file weather-translate.c, where you will find references and
-explanations for the weather symbols.
+As of 0.8.3, xfce4-weather-plugin supports icon themes. This requires
+a specific icon naming scheme that corresponds to the met.no API
+symbols definition. Icon sets following the freedesktop.org
+standardized naming scheme are not supported because they lack too
+many icons the plugin would need for the various weather conditions
+provided by met.no, so adhereing to the standard wouldn't make much
+sense (see 2) for more information ).
+
+If you want to design your own set, please have a look at the default
+Liquid theme that is included in this package to get an idea what the
+icons should look like and at the source file weather-translate.c,
+where you will find references and explanations for the weather
+symbols.
+
+The plugin searches for icon themes in the following directories, in
+this particular order:
+$XDG_CONFIG_HOME/xfce/weather/icons
+$(datadir)/icons
+
+Where
+* $XDG_CONFIG_HOME is usually /home/user/.config
+* $(datadir) is whatever you configured it to be on build-time, like
+  /usr/local/share/xfce4/weather/icons or
+  /usr/share/xfce4/weather/icons
+
+In these directories the plugin shall find subdirectories that contain
+the icon themes. Let's look at the structure by example of the Liquid
+theme (files or directories in brackets [] are optional):
+
+Liquid
+|--22
+|--48
+|--128
+\--theme.info
+
+The theme.info file needs to be present, or the plugin will not
+consider the directory a valid icon theme. This file should contain
+the following entries:
+------------------------------- theme.info -------------------------------
+Name=Liquid
+Author=Unknown
+Description=Modified icon theme originating from the Superkaramaba Liquid Weather plugin
+License=GPL-2
+-------------------------- theme.info ends here --------------------------
+
+Make sure that each entry is on one line. Entries may not span
+multiple line, the additional lines will be ignored. These values will
+be shown in the theme selection in the configuration dialog.
+
+Directories 22, 48 and 128 shall contain the icons at approximately
+the size the directory names suggest. Icon sizes for the panel icon
+will be chosen depending on the panel size. For the tooltip, the icon
+will be taken from the 128 directory, and medium sized icons (48) for
+the forecast window and similar places.
+
+Here is a list showing which icon sizes are recommended for the
+various panel sizes:
+
+Directory   Panel size    Recommended icon sizes
+22          16-23         22, 24, 16
+48          24-48         48, 24, 32
+128         49-128        128, 96, 80, 64
+
+To be found by the plugin, the icons need to be named exactly as
+follows (listed in alphabetical order):
+
+* cloud.png
+* fog.png
+* lightcloud.png
+* lightrain.png
+* lightrainsun.png
+* lightrainthunder.png
+* lightrainthundersun.png
+* nodata.png
+* partlycloud.png
+* rain.png
+* rainthunder.png
+* sleet.png
+* sleetsun.png
+* sleetsunthunder.png
+* sleetthunder.png
+* snow.png
+* snowsun.png
+* snowsunthunder.png
+* snowthunder.png
+* sun.png
+
+At night time, the plugin will first look for icons having a "-night"
+suffix, e.g. cloud-night.png, lightrainsun-night.png etc. The rest of
+the filename needs to be the same as for the day icon, and the icons
+should probably look similar, however with brother sun replaced by
+sister moon. Of course, the latter is rather a design decision than a
+technical necessity. If no night icon is provided, the plugin will
+fallback to using the day icon.
+
+An exception is the NODATA icon, which has no night variant. Further,
+it will only be shown when the plugin has not been configured yet -
+but then more likely only the NODATA icon of the default theme will
+appear and not that of your theme -, or when there is no data
+available, for example in case of a network error. It also serves as
+the fallback icon for all missing day icons. Finally, if you do not
+provide a NODATA icon for your theme, then the one of the default
+theme will be used which is assumed to always be present.
+
+As is indirectly conveyed by this list, all files need to be in PNG
+format.
+
+All icon sets included and distributed in the xfce4-weather-plugin
+package are under GPL by default. If an icon set differs from this
+license, please put an extra LICENSE file in the theme directory.
+
+2) Freedesktop standardized naming scheme
+--------------------------------------------------------------------------
 
 It was suggested (http://mail.xfce.org/pipermail/xfce/2012-August/031180.html)
 to make use of icon themes implementing the freedesktop standardized naming
@@ -115,27 +220,27 @@ This might not be such a good idea, however, because
 * it is unclear what to do when those icons are missing, and solving
   this in a good manner will make things unnecessarily complicated for
   the plugin,
-* with the liquid icon set there already is a good default icon set that
+* with the Liquid icon set there already is a good default icon set that
   suits most users,
-* the deficiences of the liquid theme can be solved more easily with
+* the deficiences of the Liquid theme can be solved more easily with
   proper theming support and a bit of editing (providing an
-  alternative liquid theme for dark panels).
+  alternative Liquid theme for dark panels).
 
 Of course, you might take any such freedesktop compliant theme as the
 basis for your personal new icon set, so you only have to design or
 assemble the remaining few icons. And finally, with a bit of searching
 you can find lots of free-to-use icons and icon sets on the web!
 
-2) The "liquid" icon theme and its license
+3) The "Liquid" icon theme and its license
 --------------------------------------------------------------------------
 
-In August 2012 a question was raised about the license of the liquid
+In August 2012 a question was raised about the license of the Liquid
 icon theme (see http://mail.xfce.org/pipermail/xfce/2012-August/031178.html
 and http://mail.xfce.org/pipermail/xfce/2012-August/031188.html for
 further discussion), so let's elaborate a bit on that.
 
 According to original author of the plugin, Bob Schlärmann, the
-"liquid" icon theme originates from the now abandoned "Liquid Weather"
+"Liquid" icon theme originates from the now abandoned "Liquid Weather"
 package for KDE Superkaramba and has been part of the weather plugin
 since around 2004. While this is not 100% certain, it is supposed to
 be licensed under GPL-2, as is the "Liquid Weather" script.
@@ -169,7 +274,7 @@ A further look at http://kde-look.org/content/show.php?content=6384,
 brings forth this bit of information: "License: Everything is GPL,
 EXCEPT FOR some of the icon sets, which are distributed with the
 permission of their authors." Looking at the archived web page above,
-the liquid weather icon set is not to be found in the exceptions list,
+the Liquid weather icon set is not to be found in the exceptions list,
 so according to that it should be GPL. Besides, the similarity of the name of both
 the icon set and its containing package also hints to that licensing.
 
diff --git a/configure.ac.in b/configure.ac.in
index 94fe8b7..2c6ccdd 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -79,5 +79,8 @@ panel-plugin/Makefile
 po/Makefile.in
 icons/Makefile
 icons/liquid/Makefile
+icons/liquid/22/Makefile
+icons/liquid/48/Makefile
+icons/liquid/128/Makefile
 icons/48x48/Makefile
 ])
diff --git a/icons/liquid/128/Makefile.am b/icons/liquid/128/Makefile.am
new file mode 100644
index 0000000..94ed24a
--- /dev/null
+++ b/icons/liquid/128/Makefile.am
@@ -0,0 +1,38 @@
+size = 128
+
+iconsdir = $(datadir)/xfce4/weather/icons/liquid/$(size)
+
+icons_DATA = nodata.png                 \
+    cloud.png                           \
+    fog.png                             \
+    lightcloud.png                      \
+    lightcloud-night.png                \
+    lightrain.png                       \
+    lightrainsun.png                    \
+    lightrainsun-night.png              \
+    lightrainthunder.png                \
+    lightrainthundersun.png             \
+    lightrainthundersun-night.png       \
+    partlycloud.png                     \
+    partlycloud-night.png               \
+    rain.png                            \
+    rainthunder.png                     \
+    sleet.png                           \
+    sleetsun.png                        \
+    sleetsun-night.png                  \
+    sleetsunthunder.png                 \
+    sleetsunthunder-night.png           \
+    sleetthunder.png                    \
+    snow.png                            \
+    snowsun.png                         \
+    snowsun-night.png                   \
+    snowsunthunder.png                  \
+    snowsunthunder-night.png            \
+    snowthunder.png                     \
+    sun.png                             \
+    sun-night.png
+
+EXTRA_DIST =                            \
+    $(icons_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/icons/liquid/CLOUD.png b/icons/liquid/128/cloud.png
similarity index 100%
rename from icons/liquid/CLOUD.png
rename to icons/liquid/128/cloud.png
diff --git a/icons/liquid/FOG.png b/icons/liquid/128/fog.png
similarity index 100%
rename from icons/liquid/FOG.png
rename to icons/liquid/128/fog.png
diff --git a/icons/liquid/LIGHTCLOUD-night.png b/icons/liquid/128/lightcloud-night.png
similarity index 100%
rename from icons/liquid/LIGHTCLOUD-night.png
rename to icons/liquid/128/lightcloud-night.png
diff --git a/icons/liquid/LIGHTCLOUD.png b/icons/liquid/128/lightcloud.png
similarity index 100%
rename from icons/liquid/LIGHTCLOUD.png
rename to icons/liquid/128/lightcloud.png
diff --git a/icons/liquid/LIGHTRAIN.png b/icons/liquid/128/lightrain.png
similarity index 100%
rename from icons/liquid/LIGHTRAIN.png
rename to icons/liquid/128/lightrain.png
diff --git a/icons/liquid/LIGHTRAINSUN-night.png b/icons/liquid/128/lightrainsun-night.png
similarity index 100%
rename from icons/liquid/LIGHTRAINSUN-night.png
rename to icons/liquid/128/lightrainsun-night.png
diff --git a/icons/liquid/LIGHTRAINSUN.png b/icons/liquid/128/lightrainsun.png
similarity index 100%
rename from icons/liquid/LIGHTRAINSUN.png
rename to icons/liquid/128/lightrainsun.png
diff --git a/icons/liquid/LIGHTRAINTHUNDER.png b/icons/liquid/128/lightrainthunder.png
similarity index 100%
rename from icons/liquid/LIGHTRAINTHUNDER.png
rename to icons/liquid/128/lightrainthunder.png
diff --git a/icons/liquid/LIGHTRAINTHUNDERSUN-night.png b/icons/liquid/128/lightrainthundersun-night.png
similarity index 100%
rename from icons/liquid/LIGHTRAINTHUNDERSUN-night.png
rename to icons/liquid/128/lightrainthundersun-night.png
diff --git a/icons/liquid/LIGHTRAINTHUNDERSUN.png b/icons/liquid/128/lightrainthundersun.png
similarity index 100%
rename from icons/liquid/LIGHTRAINTHUNDERSUN.png
rename to icons/liquid/128/lightrainthundersun.png
diff --git a/icons/liquid/NODATA.png b/icons/liquid/128/nodata.png
similarity index 100%
rename from icons/liquid/NODATA.png
rename to icons/liquid/128/nodata.png
diff --git a/icons/liquid/PARTLYCLOUD-night.png b/icons/liquid/128/partlycloud-night.png
similarity index 100%
rename from icons/liquid/PARTLYCLOUD-night.png
rename to icons/liquid/128/partlycloud-night.png
diff --git a/icons/liquid/PARTLYCLOUD.png b/icons/liquid/128/partlycloud.png
similarity index 100%
rename from icons/liquid/PARTLYCLOUD.png
rename to icons/liquid/128/partlycloud.png
diff --git a/icons/liquid/RAIN.png b/icons/liquid/128/rain.png
similarity index 100%
rename from icons/liquid/RAIN.png
rename to icons/liquid/128/rain.png
diff --git a/icons/liquid/RAINTHUNDER.png b/icons/liquid/128/rainthunder.png
similarity index 100%
rename from icons/liquid/RAINTHUNDER.png
rename to icons/liquid/128/rainthunder.png
diff --git a/icons/liquid/SLEET.png b/icons/liquid/128/sleet.png
similarity index 100%
rename from icons/liquid/SLEET.png
rename to icons/liquid/128/sleet.png
diff --git a/icons/liquid/SLEETSUN-night.png b/icons/liquid/128/sleetsun-night.png
similarity index 100%
rename from icons/liquid/SLEETSUN-night.png
rename to icons/liquid/128/sleetsun-night.png
diff --git a/icons/liquid/SLEETSUN.png b/icons/liquid/128/sleetsun.png
similarity index 100%
rename from icons/liquid/SLEETSUN.png
rename to icons/liquid/128/sleetsun.png
diff --git a/icons/liquid/SLEETSUNTHUNDER-night.png b/icons/liquid/128/sleetsunthunder-night.png
similarity index 100%
rename from icons/liquid/SLEETSUNTHUNDER-night.png
rename to icons/liquid/128/sleetsunthunder-night.png
diff --git a/icons/liquid/SLEETSUNTHUNDER.png b/icons/liquid/128/sleetsunthunder.png
similarity index 100%
rename from icons/liquid/SLEETSUNTHUNDER.png
rename to icons/liquid/128/sleetsunthunder.png
diff --git a/icons/liquid/SLEETTHUNDER.png b/icons/liquid/128/sleetthunder.png
similarity index 100%
rename from icons/liquid/SLEETTHUNDER.png
rename to icons/liquid/128/sleetthunder.png
diff --git a/icons/liquid/SNOW.png b/icons/liquid/128/snow.png
similarity index 100%
rename from icons/liquid/SNOW.png
rename to icons/liquid/128/snow.png
diff --git a/icons/liquid/SNOWSUN-night.png b/icons/liquid/128/snowsun-night.png
similarity index 100%
rename from icons/liquid/SNOWSUN-night.png
rename to icons/liquid/128/snowsun-night.png
diff --git a/icons/liquid/SNOWSUN.png b/icons/liquid/128/snowsun.png
similarity index 100%
rename from icons/liquid/SNOWSUN.png
rename to icons/liquid/128/snowsun.png
diff --git a/icons/liquid/SNOWSUNTHUNDER-night.png b/icons/liquid/128/snowsunthunder-night.png
similarity index 100%
rename from icons/liquid/SNOWSUNTHUNDER-night.png
rename to icons/liquid/128/snowsunthunder-night.png
diff --git a/icons/liquid/SNOWSUNTHUNDER.png b/icons/liquid/128/snowsunthunder.png
similarity index 100%
rename from icons/liquid/SNOWSUNTHUNDER.png
rename to icons/liquid/128/snowsunthunder.png
diff --git a/icons/liquid/SNOWTHUNDER.png b/icons/liquid/128/snowthunder.png
similarity index 100%
rename from icons/liquid/SNOWTHUNDER.png
rename to icons/liquid/128/snowthunder.png
diff --git a/icons/liquid/SUN-night.png b/icons/liquid/128/sun-night.png
similarity index 100%
rename from icons/liquid/SUN-night.png
rename to icons/liquid/128/sun-night.png
diff --git a/icons/liquid/SUN.png b/icons/liquid/128/sun.png
similarity index 100%
rename from icons/liquid/SUN.png
rename to icons/liquid/128/sun.png
diff --git a/icons/liquid/22/Makefile.am b/icons/liquid/22/Makefile.am
new file mode 100644
index 0000000..0eca688
--- /dev/null
+++ b/icons/liquid/22/Makefile.am
@@ -0,0 +1,38 @@
+size = 22
+
+iconsdir = $(datadir)/xfce4/weather/icons/liquid/$(size)
+
+icons_DATA = nodata.png                 \
+    cloud.png                           \
+    fog.png                             \
+    lightcloud.png                      \
+    lightcloud-night.png                \
+    lightrain.png                       \
+    lightrainsun.png                    \
+    lightrainsun-night.png              \
+    lightrainthunder.png                \
+    lightrainthundersun.png             \
+    lightrainthundersun-night.png       \
+    partlycloud.png                     \
+    partlycloud-night.png               \
+    rain.png                            \
+    rainthunder.png                     \
+    sleet.png                           \
+    sleetsun.png                        \
+    sleetsun-night.png                  \
+    sleetsunthunder.png                 \
+    sleetsunthunder-night.png           \
+    sleetthunder.png                    \
+    snow.png                            \
+    snowsun.png                         \
+    snowsun-night.png                   \
+    snowsunthunder.png                  \
+    snowsunthunder-night.png            \
+    snowthunder.png                     \
+    sun.png                             \
+    sun-night.png
+
+EXTRA_DIST =                            \
+    $(icons_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/icons/liquid/22/cloud.png b/icons/liquid/22/cloud.png
new file mode 100644
index 0000000..80a7304
Binary files /dev/null and b/icons/liquid/22/cloud.png differ
diff --git a/icons/liquid/22/fog.png b/icons/liquid/22/fog.png
new file mode 100644
index 0000000..8dd08bd
Binary files /dev/null and b/icons/liquid/22/fog.png differ
diff --git a/icons/liquid/22/lightcloud-night.png b/icons/liquid/22/lightcloud-night.png
new file mode 100644
index 0000000..5c4a0c2
Binary files /dev/null and b/icons/liquid/22/lightcloud-night.png differ
diff --git a/icons/liquid/22/lightcloud.png b/icons/liquid/22/lightcloud.png
new file mode 100644
index 0000000..2fa8a17
Binary files /dev/null and b/icons/liquid/22/lightcloud.png differ
diff --git a/icons/liquid/22/lightrain.png b/icons/liquid/22/lightrain.png
new file mode 100644
index 0000000..4617b27
Binary files /dev/null and b/icons/liquid/22/lightrain.png differ
diff --git a/icons/liquid/22/lightrainsun-night.png b/icons/liquid/22/lightrainsun-night.png
new file mode 100644
index 0000000..86d5b39
Binary files /dev/null and b/icons/liquid/22/lightrainsun-night.png differ
diff --git a/icons/liquid/22/lightrainsun.png b/icons/liquid/22/lightrainsun.png
new file mode 100644
index 0000000..6731460
Binary files /dev/null and b/icons/liquid/22/lightrainsun.png differ
diff --git a/icons/liquid/22/lightrainthunder.png b/icons/liquid/22/lightrainthunder.png
new file mode 100644
index 0000000..a1460a1
Binary files /dev/null and b/icons/liquid/22/lightrainthunder.png differ
diff --git a/icons/liquid/22/lightrainthundersun-night.png b/icons/liquid/22/lightrainthundersun-night.png
new file mode 100644
index 0000000..d822434
Binary files /dev/null and b/icons/liquid/22/lightrainthundersun-night.png differ
diff --git a/icons/liquid/22/lightrainthundersun.png b/icons/liquid/22/lightrainthundersun.png
new file mode 100644
index 0000000..e0b33d6
Binary files /dev/null and b/icons/liquid/22/lightrainthundersun.png differ
diff --git a/icons/liquid/22/nodata.png b/icons/liquid/22/nodata.png
new file mode 100644
index 0000000..44e2e1c
Binary files /dev/null and b/icons/liquid/22/nodata.png differ
diff --git a/icons/liquid/22/partlycloud-night.png b/icons/liquid/22/partlycloud-night.png
new file mode 100644
index 0000000..b70ed85
Binary files /dev/null and b/icons/liquid/22/partlycloud-night.png differ
diff --git a/icons/liquid/22/partlycloud.png b/icons/liquid/22/partlycloud.png
new file mode 100644
index 0000000..28ff66d
Binary files /dev/null and b/icons/liquid/22/partlycloud.png differ
diff --git a/icons/liquid/22/rain.png b/icons/liquid/22/rain.png
new file mode 100644
index 0000000..8aa8d84
Binary files /dev/null and b/icons/liquid/22/rain.png differ
diff --git a/icons/liquid/22/rainthunder.png b/icons/liquid/22/rainthunder.png
new file mode 100644
index 0000000..2abe5a6
Binary files /dev/null and b/icons/liquid/22/rainthunder.png differ
diff --git a/icons/liquid/22/sleet.png b/icons/liquid/22/sleet.png
new file mode 100644
index 0000000..80ad86d
Binary files /dev/null and b/icons/liquid/22/sleet.png differ
diff --git a/icons/liquid/22/sleetsun-night.png b/icons/liquid/22/sleetsun-night.png
new file mode 100644
index 0000000..79da2e1
Binary files /dev/null and b/icons/liquid/22/sleetsun-night.png differ
diff --git a/icons/liquid/22/sleetsun.png b/icons/liquid/22/sleetsun.png
new file mode 100644
index 0000000..64ec873
Binary files /dev/null and b/icons/liquid/22/sleetsun.png differ
diff --git a/icons/liquid/22/sleetsunthunder-night.png b/icons/liquid/22/sleetsunthunder-night.png
new file mode 100644
index 0000000..e541734
Binary files /dev/null and b/icons/liquid/22/sleetsunthunder-night.png differ
diff --git a/icons/liquid/22/sleetsunthunder.png b/icons/liquid/22/sleetsunthunder.png
new file mode 100644
index 0000000..f4c19bd
Binary files /dev/null and b/icons/liquid/22/sleetsunthunder.png differ
diff --git a/icons/liquid/22/sleetthunder.png b/icons/liquid/22/sleetthunder.png
new file mode 100644
index 0000000..6830cbd
Binary files /dev/null and b/icons/liquid/22/sleetthunder.png differ
diff --git a/icons/liquid/22/snow.png b/icons/liquid/22/snow.png
new file mode 100644
index 0000000..5f2701a
Binary files /dev/null and b/icons/liquid/22/snow.png differ
diff --git a/icons/liquid/22/snowsun-night.png b/icons/liquid/22/snowsun-night.png
new file mode 100644
index 0000000..18d14b0
Binary files /dev/null and b/icons/liquid/22/snowsun-night.png differ
diff --git a/icons/liquid/22/snowsun.png b/icons/liquid/22/snowsun.png
new file mode 100644
index 0000000..e54a16c
Binary files /dev/null and b/icons/liquid/22/snowsun.png differ
diff --git a/icons/liquid/22/snowsunthunder-night.png b/icons/liquid/22/snowsunthunder-night.png
new file mode 100644
index 0000000..258f621
Binary files /dev/null and b/icons/liquid/22/snowsunthunder-night.png differ
diff --git a/icons/liquid/22/snowsunthunder.png b/icons/liquid/22/snowsunthunder.png
new file mode 100644
index 0000000..7d37d45
Binary files /dev/null and b/icons/liquid/22/snowsunthunder.png differ
diff --git a/icons/liquid/22/snowthunder.png b/icons/liquid/22/snowthunder.png
new file mode 100644
index 0000000..4f9a1fe
Binary files /dev/null and b/icons/liquid/22/snowthunder.png differ
diff --git a/icons/liquid/22/sun-night.png b/icons/liquid/22/sun-night.png
new file mode 100644
index 0000000..e6fbf60
Binary files /dev/null and b/icons/liquid/22/sun-night.png differ
diff --git a/icons/liquid/22/sun.png b/icons/liquid/22/sun.png
new file mode 100644
index 0000000..bffee75
Binary files /dev/null and b/icons/liquid/22/sun.png differ
diff --git a/icons/liquid/48/Makefile.am b/icons/liquid/48/Makefile.am
new file mode 100644
index 0000000..9bf0481
--- /dev/null
+++ b/icons/liquid/48/Makefile.am
@@ -0,0 +1,38 @@
+size = 48
+
+iconsdir = $(datadir)/xfce4/weather/icons/liquid/$(size)
+
+icons_DATA = nodata.png                 \
+    cloud.png                           \
+    fog.png                             \
+    lightcloud.png                      \
+    lightcloud-night.png                \
+    lightrain.png                       \
+    lightrainsun.png                    \
+    lightrainsun-night.png              \
+    lightrainthunder.png                \
+    lightrainthundersun.png             \
+    lightrainthundersun-night.png       \
+    partlycloud.png                     \
+    partlycloud-night.png               \
+    rain.png                            \
+    rainthunder.png                     \
+    sleet.png                           \
+    sleetsun.png                        \
+    sleetsun-night.png                  \
+    sleetsunthunder.png                 \
+    sleetsunthunder-night.png           \
+    sleetthunder.png                    \
+    snow.png                            \
+    snowsun.png                         \
+    snowsun-night.png                   \
+    snowsunthunder.png                  \
+    snowsunthunder-night.png            \
+    snowthunder.png                     \
+    sun.png                             \
+    sun-night.png
+
+EXTRA_DIST =                            \
+    $(icons_DATA)
+
+# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/icons/liquid/48/cloud.png b/icons/liquid/48/cloud.png
new file mode 100644
index 0000000..88d4354
Binary files /dev/null and b/icons/liquid/48/cloud.png differ
diff --git a/icons/liquid/48/fog.png b/icons/liquid/48/fog.png
new file mode 100644
index 0000000..1ab220d
Binary files /dev/null and b/icons/liquid/48/fog.png differ
diff --git a/icons/liquid/48/lightcloud-night.png b/icons/liquid/48/lightcloud-night.png
new file mode 100644
index 0000000..261ae89
Binary files /dev/null and b/icons/liquid/48/lightcloud-night.png differ
diff --git a/icons/liquid/48/lightcloud.png b/icons/liquid/48/lightcloud.png
new file mode 100644
index 0000000..baab651
Binary files /dev/null and b/icons/liquid/48/lightcloud.png differ
diff --git a/icons/liquid/48/lightrain.png b/icons/liquid/48/lightrain.png
new file mode 100644
index 0000000..56dc804
Binary files /dev/null and b/icons/liquid/48/lightrain.png differ
diff --git a/icons/liquid/48/lightrainsun-night.png b/icons/liquid/48/lightrainsun-night.png
new file mode 100644
index 0000000..98e38e5
Binary files /dev/null and b/icons/liquid/48/lightrainsun-night.png differ
diff --git a/icons/liquid/48/lightrainsun.png b/icons/liquid/48/lightrainsun.png
new file mode 100644
index 0000000..b692b7e
Binary files /dev/null and b/icons/liquid/48/lightrainsun.png differ
diff --git a/icons/liquid/48/lightrainthunder.png b/icons/liquid/48/lightrainthunder.png
new file mode 100644
index 0000000..c3cdc84
Binary files /dev/null and b/icons/liquid/48/lightrainthunder.png differ
diff --git a/icons/liquid/48/lightrainthundersun-night.png b/icons/liquid/48/lightrainthundersun-night.png
new file mode 100644
index 0000000..5de043b
Binary files /dev/null and b/icons/liquid/48/lightrainthundersun-night.png differ
diff --git a/icons/liquid/48/lightrainthundersun.png b/icons/liquid/48/lightrainthundersun.png
new file mode 100644
index 0000000..a36ecee
Binary files /dev/null and b/icons/liquid/48/lightrainthundersun.png differ
diff --git a/icons/liquid/48/nodata.png b/icons/liquid/48/nodata.png
new file mode 100644
index 0000000..bdb58bf
Binary files /dev/null and b/icons/liquid/48/nodata.png differ
diff --git a/icons/liquid/48/partlycloud-night.png b/icons/liquid/48/partlycloud-night.png
new file mode 100644
index 0000000..0c31c56
Binary files /dev/null and b/icons/liquid/48/partlycloud-night.png differ
diff --git a/icons/liquid/48/partlycloud.png b/icons/liquid/48/partlycloud.png
new file mode 100644
index 0000000..b1e6feb
Binary files /dev/null and b/icons/liquid/48/partlycloud.png differ
diff --git a/icons/liquid/48/rain.png b/icons/liquid/48/rain.png
new file mode 100644
index 0000000..6c1eca3
Binary files /dev/null and b/icons/liquid/48/rain.png differ
diff --git a/icons/liquid/48/rainthunder.png b/icons/liquid/48/rainthunder.png
new file mode 100644
index 0000000..3353e05
Binary files /dev/null and b/icons/liquid/48/rainthunder.png differ
diff --git a/icons/liquid/48/sleet.png b/icons/liquid/48/sleet.png
new file mode 100644
index 0000000..2ebb8c8
Binary files /dev/null and b/icons/liquid/48/sleet.png differ
diff --git a/icons/liquid/48/sleetsun-night.png b/icons/liquid/48/sleetsun-night.png
new file mode 100644
index 0000000..3e0e803
Binary files /dev/null and b/icons/liquid/48/sleetsun-night.png differ
diff --git a/icons/liquid/48/sleetsun.png b/icons/liquid/48/sleetsun.png
new file mode 100644
index 0000000..fca003b
Binary files /dev/null and b/icons/liquid/48/sleetsun.png differ
diff --git a/icons/liquid/48/sleetsunthunder-night.png b/icons/liquid/48/sleetsunthunder-night.png
new file mode 100644
index 0000000..547bd41
Binary files /dev/null and b/icons/liquid/48/sleetsunthunder-night.png differ
diff --git a/icons/liquid/48/sleetsunthunder.png b/icons/liquid/48/sleetsunthunder.png
new file mode 100644
index 0000000..1aab598
Binary files /dev/null and b/icons/liquid/48/sleetsunthunder.png differ
diff --git a/icons/liquid/48/sleetthunder.png b/icons/liquid/48/sleetthunder.png
new file mode 100644
index 0000000..99f1d39
Binary files /dev/null and b/icons/liquid/48/sleetthunder.png differ
diff --git a/icons/liquid/48/snow.png b/icons/liquid/48/snow.png
new file mode 100644
index 0000000..6cf8cc7
Binary files /dev/null and b/icons/liquid/48/snow.png differ
diff --git a/icons/liquid/48/snowsun-night.png b/icons/liquid/48/snowsun-night.png
new file mode 100644
index 0000000..3e13512
Binary files /dev/null and b/icons/liquid/48/snowsun-night.png differ
diff --git a/icons/liquid/48/snowsun.png b/icons/liquid/48/snowsun.png
new file mode 100644
index 0000000..5abffb1
Binary files /dev/null and b/icons/liquid/48/snowsun.png differ
diff --git a/icons/liquid/48/snowsunthunder-night.png b/icons/liquid/48/snowsunthunder-night.png
new file mode 100644
index 0000000..398562a
Binary files /dev/null and b/icons/liquid/48/snowsunthunder-night.png differ
diff --git a/icons/liquid/48/snowsunthunder.png b/icons/liquid/48/snowsunthunder.png
new file mode 100644
index 0000000..2f396aa
Binary files /dev/null and b/icons/liquid/48/snowsunthunder.png differ
diff --git a/icons/liquid/48/snowthunder.png b/icons/liquid/48/snowthunder.png
new file mode 100644
index 0000000..988a316
Binary files /dev/null and b/icons/liquid/48/snowthunder.png differ
diff --git a/icons/liquid/48/sun-night.png b/icons/liquid/48/sun-night.png
new file mode 100644
index 0000000..e66f4d3
Binary files /dev/null and b/icons/liquid/48/sun-night.png differ
diff --git a/icons/liquid/48/sun.png b/icons/liquid/48/sun.png
new file mode 100644
index 0000000..913c5f8
Binary files /dev/null and b/icons/liquid/48/sun.png differ
diff --git a/icons/liquid/Makefile.am b/icons/liquid/Makefile.am
index dfc273c..94bdd1a 100644
--- a/icons/liquid/Makefile.am
+++ b/icons/liquid/Makefile.am
@@ -1,36 +1,9 @@
 liquiddir = $(datadir)/xfce4/weather/icons/liquid
 
-liquid_DATA = NODATA.png			\
-	CLOUD.png			\
-	FOG.png				\
-	LIGHTCLOUD.png			\
-	LIGHTRAIN.png			\
-	LIGHTRAINSUN.png		\
-	LIGHTRAINTHUNDER.png		\
-	LIGHTRAINTHUNDERSUN.png		\
-	PARTLYCLOUD.png			\
-	RAIN.png			\
-	RAINTHUNDER.png			\
-	SLEET.png			\
-	SLEETSUN.png			\
-	SLEETSUNTHUNDER.png		\
-	SLEETTHUNDER.png		\
-	SNOW.png			\
-	SNOWSUN.png			\
-	SNOWSUNTHUNDER.png		\
-	SNOWTHUNDER.png			\
-	SUN.png				\
-	LIGHTCLOUD-night.png		\
-	LIGHTRAINSUN-night.png		\
-	LIGHTRAINTHUNDERSUN-night.png	\
-	PARTLYCLOUD-night.png		\
-	SLEETSUN-night.png		\
-	SLEETSUNTHUNDER-night.png	\
-	SNOWSUN-night.png		\
-	SNOWSUNTHUNDER-night.png	\
-	SUN-night.png
+SUBDIRS = 22 48 128
 
-EXTRA_DIST =								\
-	$(liquid_DATA)
+liquid_DATA = theme.info
+
+EXTRA_DIST = $(liquid_DATA)
 
 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/icons/liquid/theme.info b/icons/liquid/theme.info
new file mode 100644
index 0000000..0561ba4
--- /dev/null
+++ b/icons/liquid/theme.info
@@ -0,0 +1,4 @@
+Name=Liquid
+Author=Unknown
+Description=Modified icon theme originating from the Superkaramaba Liquid Weather plugin
+License=GPL-2
diff --git a/panel-plugin/weather-debug.c b/panel-plugin/weather-debug.c
index 5d142ae..686e6bf 100644
--- a/panel-plugin/weather-debug.c
+++ b/panel-plugin/weather-debug.c
@@ -172,6 +172,31 @@ weather_dump_place(const xml_place *place)
 
 
 gchar *
+weather_dump_icon_theme(const icon_theme *theme)
+{
+    gchar *out;
+
+    if (!theme)
+        return g_strdup("No icon theme data.");
+
+    out = g_strdup_printf("Icon theme data:\n"
+                          "  --------------------------------------------\n"
+                          "  Dir: %s\n"
+                          "  Name: %s\n"
+                          "  Author: %s\n"
+                          "  Description: %s\n"
+                          "  License: %s\n"
+                          "  --------------------------------------------",
+                          theme->dir,
+                          theme->name,
+                          theme->author,
+                          theme->description,
+                          theme->license);
+    return out;
+}
+
+
+gchar *
 weather_dump_astrodata(const xml_astro *astro)
 {
     gchar *out, *sunrise, *sunset, *moonrise, *moonset;
diff --git a/panel-plugin/weather-debug.h b/panel-plugin/weather-debug.h
index eee2492..092c9be 100644
--- a/panel-plugin/weather-debug.h
+++ b/panel-plugin/weather-debug.h
@@ -24,6 +24,7 @@
 
 #include "weather-parsers.h"
 #include "weather-data.h"
+#include "weather-icon.h"
 #include "weather.h"
 
 G_BEGIN_DECLS
@@ -63,6 +64,8 @@ gchar *weather_dump_geolocation(const xml_geolocation *geo);
 
 gchar *weather_dump_place(const xml_place *place);
 
+gchar *weather_dump_icon_theme(const icon_theme *theme);
+
 gchar *weather_dump_astrodata(const xml_astro *astrodata);
 
 gchar *weather_dump_weatherdata(const xml_weather *weatherdata);
diff --git a/panel-plugin/weather-icon.c b/panel-plugin/weather-icon.c
index e15385f..c11633e 100644
--- a/panel-plugin/weather-icon.c
+++ b/panel-plugin/weather-icon.c
@@ -24,72 +24,203 @@
 #include <gtk/gtk.h>
 #include <string.h>
 
+#include <libxfce4util/libxfce4util.h>
+
 #include "weather-icon.h"
+#include "weather-debug.h"
 
 #define DEFAULT_W_THEME "liquid"
+#define THEME_INFO_FILE "theme.info"
+#define ICON_DIR_SMALL "22"
+#define ICON_DIR_MEDIUM "48"
+#define ICON_DIR_BIG "128"
 #define NODATA "NODATA"
 
 
-/* For these symbols, there will be a separate icon used for night time */
-const gchar *night_symbols[] = {
-    "LIGHTCLOUD",
-    "LIGHTRAINSUN",
-    "LIGHTRAINTHUNDERSUN",
-    "PARTLYCLOUD",
-    "SLEETSUN",
-    "SLEETSUNTHUNDER"
-    "SNOWSUN",
-    "SNOWSUNTHUNDER",
-    "SUN",
-    NULL
-};
-
-
 GdkPixbuf *
-get_icon(const gchar *number,
+get_icon(const icon_theme *theme,
+         const gchar *number,
          const gint size,
          const gboolean night)
 {
     GdkPixbuf *image = NULL;
-    gchar *filename, *night_suffix = "";
-    gint number_len, night_symbol_len;
+    const gchar* dir;
+    gchar *filename, *suffix = "";
     guint i;
 
+    g_assert(theme != NULL);
+    if (G_UNLIKELY(!theme)) {
+        g_warning("No icon theme!");
+        return NULL;
+    }
+
+    /* Try to use optimal size */
+    if (size < 24)
+        dir = ICON_DIR_SMALL;
+    else if (size < 49)
+        dir = ICON_DIR_MEDIUM;
+    else
+        dir = ICON_DIR_BIG;
+
     if (number == NULL || strlen(number) == 0)
         number = NODATA;
-    else if (night) {
-        number_len = strlen(number);
-        for (i = 0; night_symbols[i] != NULL; i++) {
-            night_symbol_len = strlen(night_symbols[i]);
-            if (number_len != night_symbol_len)
-                continue;
-
-            if (number[0] != night_symbols[i][0])
-                continue;
-
-            if (!g_ascii_strncasecmp(night_symbols[i], number, number_len))
-                night_suffix = "-night";
-        }
-    }
+    else if (night)
+        suffix = "-night";
 
-    filename = g_strdup_printf("%s" G_DIR_SEPARATOR_S
-                               "%s" G_DIR_SEPARATOR_S
-                               "%s%s.png",
-                               THEMESDIR,
-                               DEFAULT_W_THEME,
-                               number,
-                               night_suffix);
+    filename = g_strconcat(theme->dir, G_DIR_SEPARATOR_S,
+                           dir, G_DIR_SEPARATOR_S,
+                           g_ascii_strdown(number, -1),
+                           suffix, ".png", NULL);
 
     image = gdk_pixbuf_new_from_file_at_scale(filename, size, size, TRUE, NULL);
 
     if (G_UNLIKELY(!image)) {
-        g_warning("Unable to open image: %s", filename);
+        weather_debug("Unable to open image: %s", filename);
         if (number && strcmp(number, NODATA)) {
             g_free(filename);
-            return get_icon(NULL, size, FALSE);
+
+            /* maybe there is no night icon, so fallback to using day icon */
+            if (night)
+                return get_icon(theme, number, size, FALSE);
+            else
+                return get_icon(theme, NULL, size, FALSE);
+        } else {
+            /* last fallback: get NODATA icon from standard theme */
+            g_free(filename);
+            filename = g_strconcat(THEMESDIR, G_DIR_SEPARATOR_S,
+                                   DEFAULT_W_THEME, G_DIR_SEPARATOR_S,
+                                   dir, G_DIR_SEPARATOR_S,
+                                   g_ascii_strdown(NODATA, -1), ".png", NULL);
+            image = gdk_pixbuf_new_from_file_at_scale(filename, size, size,
+                                                      TRUE, NULL);
+            if (G_UNLIKELY(!image))
+                g_warning("Failed to open image: %s", filename);
         }
     }
     g_free(filename);
 
     return image;
 }
+
+
+/*
+ * Load icon theme info from theme info file given a directory.
+ */
+icon_theme *
+icon_theme_load_info(const gchar *dir)
+{
+    XfceRc *rc;
+    icon_theme *theme = NULL;
+    gchar *filename;
+    const gchar *value;
+
+    g_assert(dir != NULL);
+    if (G_UNLIKELY(dir == NULL))
+        return NULL;
+
+    filename = g_build_filename(dir, G_DIR_SEPARATOR_S, THEME_INFO_FILE, NULL);
+
+    if (g_file_test(filename, G_FILE_TEST_EXISTS)) {
+        rc = xfce_rc_simple_open(filename, TRUE);
+        g_free(filename);
+        filename = NULL;
+
+        if (!rc)
+            return NULL;
+
+        if ((theme = g_slice_new0(icon_theme)) == NULL) {
+            xfce_rc_close(rc);
+            return NULL;
+        }
+
+        theme->dir = g_strdup(dir);
+
+        value = xfce_rc_read_entry(rc, "Name", NULL);
+        if (value)
+            theme->name = g_strdup(value);
+        else {
+            /* Use directory name as fallback */
+            filename = g_path_get_dirname(dir);
+            if (G_LIKELY(strcmp(filename, "."))) {
+                theme->dir = g_strdup(dir);
+                theme->name = g_strdup(filename);
+                weather_debug("No Name found in theme info file, "
+                              "using directory name %s as fallback.", dir);
+                g_free(filename);
+                filename = NULL;
+            } else { /* some weird error, not safe to proceed */
+                weather_debug("Some weird error, not safe to proceed. "
+                              "Abort loading icon theme from %s.", dir);
+                icon_theme_free(theme);
+                g_free(filename);
+                xfce_rc_close(rc);
+                return NULL;
+            }
+        }
+
+        value = xfce_rc_read_entry(rc, "Author", NULL);
+        if (value)
+            theme->author = g_strdup(value);
+
+        value = xfce_rc_read_entry(rc, "Description", NULL);
+        if (value)
+            theme->description = g_strdup(value);
+
+        value = xfce_rc_read_entry(rc, "License", NULL);
+        if (value)
+            theme->license = g_strdup(value);
+        xfce_rc_close(rc);
+    }
+
+    weather_dump(weather_dump_icon_theme, theme);
+    return theme;
+}
+
+
+/*
+ * Load theme from a directory, fallback to standard theme on failure
+ * or when dir is NULL.
+ */
+icon_theme *
+icon_theme_load(const gchar *dir)
+{
+    icon_theme *theme = NULL;
+    gchar *default_dir;
+
+    if (dir != NULL) {
+        weather_debug("Loading icon theme from %s.", dir);
+        if ((theme = icon_theme_load_info(dir)) != NULL) {
+            weather_debug("Successfully loaded theme from %s.", dir);
+            return theme;
+        } else
+            weather_debug("Error loading theme from %s.", dir);
+    }
+
+    /* on failure try the standard theme */
+    if (theme == NULL) {
+        default_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
+                                      THEMESDIR, DEFAULT_W_THEME);
+        weather_debug("Loading standard icon theme from %s.", default_dir);
+        if ((theme = icon_theme_load_info(default_dir)) != NULL)
+            weather_debug("Successfully loaded theme from %s.", default_dir);
+        else
+            weather_debug("Error loading standard theme from %s.", default_dir);
+        g_free(default_dir);
+    }
+    return theme;
+}
+
+
+void
+icon_theme_free(icon_theme *theme)
+{
+    g_assert(theme != NULL);
+    if (G_UNLIKELY(theme == NULL))
+        return;
+    g_free(theme->dir);
+    g_free(theme->name);
+    g_free(theme->author);
+    g_free(theme->description);
+    g_free(theme->license);
+    g_slice_free(icon_theme, theme);
+}
diff --git a/panel-plugin/weather-icon.h b/panel-plugin/weather-icon.h
index 2c2857e..f732782 100644
--- a/panel-plugin/weather-icon.h
+++ b/panel-plugin/weather-icon.h
@@ -21,10 +21,26 @@
 
 G_BEGIN_DECLS
 
-GdkPixbuf *get_icon(const gchar *icon,
+typedef struct {
+    gchar *dir;
+    gchar *name;
+    gchar *author;
+    gchar *description;
+    gchar *license;
+} icon_theme;
+
+
+GdkPixbuf *get_icon(const icon_theme *theme,
+                    const gchar *icon,
                     gint size,
                     gboolean night);
 
+icon_theme *icon_theme_load_info(const gchar *dir);
+
+icon_theme *icon_theme_load(const gchar *dir);
+
+void icon_theme_free(icon_theme *theme);
+
 G_END_DECLS
 
 #endif
diff --git a/panel-plugin/weather-summary.c b/panel-plugin/weather-summary.c
index 6d484be..549e5fa 100644
--- a/panel-plugin/weather-summary.c
+++ b/panel-plugin/weather-summary.c
@@ -599,7 +599,8 @@ make_forecast(xfceweather_data *data)
             if (fcdata != NULL) {
                 if (fcdata->location != NULL) {
                     rawvalue = get_data(fcdata, data->unit_system, SYMBOL);
-                    icon = get_icon(rawvalue, 48, (daytime == NIGHT));
+                    icon = get_icon(data->icon_theme, rawvalue, 48,
+                                    (daytime == NIGHT));
                     g_free(rawvalue);
                     image = gtk_image_new_from_pixbuf(icon);
                     gtk_box_pack_start(GTK_BOX(forecast_box), GTK_WIDGET(image),
@@ -774,7 +775,7 @@ create_summary_window (xfceweather_data *data)
     conditions = get_current_conditions(data->weatherdata);
 
     symbol = get_data(conditions, data->unit_system, SYMBOL);
-    icon = get_icon(symbol, 48, data->night_time);
+    icon = get_icon(data->icon_theme, symbol, 48, data->night_time);
     g_free(symbol);
 
     gtk_window_set_icon(GTK_WINDOW(window), icon);
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index a8ea0e5..c9dcffe 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -243,7 +243,7 @@ update_icon(xfceweather_data *data)
     /* set icon according to current weather conditions */
     conditions = get_current_conditions(data->weatherdata);
     str = get_data(conditions, data->unit_system, SYMBOL);
-    icon = get_icon(str, size, data->night_time);
+    icon = get_icon(data->icon_theme, str, size, data->night_time);
     g_free(str);
     gtk_image_set_from_pixbuf(GTK_IMAGE(data->iconimage), icon);
     if (G_LIKELY(icon))
@@ -623,6 +623,11 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
     gtk_scrollbox_set_animate(GTK_SCROLLBOX(data->scrollbox),
                               data->animation_transitions);
 
+    value = xfce_rc_read_entry(rc, "theme_dir", NULL);
+    if (data->icon_theme)
+        icon_theme_free(data->icon_theme);
+    data->icon_theme = icon_theme_load(value);
+
     data->labels = labels_clear(data->labels);
     val = 0;
     while (val != -1) {
@@ -682,6 +687,9 @@ xfceweather_write_config(XfcePanelPlugin *plugin,
     xfce_rc_write_bool_entry(rc, "animation_transitions",
                              data->animation_transitions);
 
+    if (data->icon_theme && data->icon_theme->dir)
+        xfce_rc_write_entry(rc, "theme_dir", data->icon_theme->dir);
+
     for (i = 0; i < data->labels->len; i++) {
         g_snprintf(label, 10, "label%d", i);
         xfce_rc_write_int_entry(rc, label,
@@ -988,7 +996,7 @@ weather_get_tooltip_cb(GtkWidget *widget,
 
     conditions = get_current_conditions(data->weatherdata);
     rawvalue = get_data(conditions, data->unit_system, SYMBOL);
-    icon = get_icon(rawvalue, 128, data->night_time);
+    icon = get_icon(data->icon_theme, rawvalue, 128, data->night_time);
     g_free(rawvalue);
     gtk_tooltip_set_icon(tooltip, icon);
     g_object_unref(G_OBJECT(icon));
@@ -1022,11 +1030,14 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
     data->scrollbox = gtk_scrollbox_new();
 
     data->size = xfce_panel_plugin_get_size(plugin);
-    icon = get_icon(NULL, 16, FALSE);
-    data->iconimage = gtk_image_new_from_pixbuf(icon);
-
-    if (G_LIKELY(icon))
+    data->icon_theme = icon_theme_load(NULL);
+    icon = get_icon(data->icon_theme, NULL, 16, FALSE);
+    if (G_LIKELY(icon)) {
+        data->iconimage = gtk_image_new_from_pixbuf(icon);
         g_object_unref(G_OBJECT(icon));
+    } else
+        g_warning("No default icon theme? "
+                  "This should not happen, plugin will crash!");
 
     data->labels = g_array_new(FALSE, TRUE, sizeof(data_types));
 
@@ -1074,7 +1085,7 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
     /* add forecast window to right click menu, for people who missed
        the left mouse click feature */
     mi = gtk_image_menu_item_new_with_mnemonic(_("_Forecast"));
-    icon = get_icon("SUN", 16, FALSE);
+    icon = get_icon(data->icon_theme, "SUN", 16, FALSE);
     gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi),
                                   gtk_image_new_from_pixbuf(icon));
     if (G_LIKELY(icon))
@@ -1142,6 +1153,9 @@ xfceweather_free(XfcePanelPlugin *plugin,
     /* free array */
     g_array_free(data->labels, TRUE);
 
+    /* free icon theme */
+    icon_theme_free(data->icon_theme);
+
     g_slice_free(xfceweather_data, data);
     data = NULL;
 }
diff --git a/panel-plugin/weather.h b/panel-plugin/weather.h
index fa67991..0031ff1 100644
--- a/panel-plugin/weather.h
+++ b/panel-plugin/weather.h
@@ -21,6 +21,8 @@
 
 #include <libxfce4panel/libxfce4panel.h>
 #include <libxfce4util/libxfce4util.h>
+#include "weather-icon.h"
+
 #define PLUGIN_WEBSITE "http://goodies.xfce.org/projects/panel-plugins/xfce4-weather-plugin"
 #define MAX_FORECAST_DAYS 10
 #define DEFAULT_FORECAST_DAYS 5
@@ -50,6 +52,8 @@ typedef struct {
     time_t last_data_update;
     time_t last_conditions_update;
 
+    icon_theme *icon_theme;
+
     gchar *lat;
     gchar *lon;
     gchar *location_name;


More information about the Xfce4-commits mailing list