I’ve been playing a bit with icons in EWL the last few days and just committed the basis of my work into CVS.

We’ve been in need of better icons in EWL for a while but neither Nathan nor I wanted to have a ton of icons imported into our theme. We wanted to let the user specify their own icon theme or Edje file for the icons.

To this end, I created an ewl_icon_theme file in EWL that allows you to queury for icon paths based on the freedeskop.org icon naming spec. (It’s a wrapper around ecore_desktop). This is working pretty well, as can be seen by:

The Icon Theme test program just has a big list of all the icons EWL knows about and displays them in a freebox. You’ll notice for some there is no image, this is because there is no image in the icon theme I’m using.

Ewl_Icon_Theme will look for the Tango icon theme by default. This is in the EWL config settings, so when Examine is working again it will be modifiable by the user to set their own icon themes.

When you query for an image you also specify the size of the image you’d like to receive. There are three defines in EWL currently for this:

  • EWL_ICON_SIZE_SMALL
  • EWL_ICON_SIZE_MEDIUM
  • EWL_ICON_SIZE_LARGE

These will give 16x16, 22x22 and 24x24 icon sizes respectively. (The parameter is actually a string, so if you need another size you can just pass the string “48x48” for example.)

There is still some work to be done to this code. The main piece is caching. Instead of going to ecore_desktop for the images every time we should be caching them into a hash that we can lookup from later. (This could use the existing theme hash). See the bug for more information on this caching.

We will be converting the stock buttons over to use the icon theme at some point in the near future (we want to give ecore_desktop sometime to stabilize first). Once this is done we should add some ‘default’ icons to the EWL E17 theme. These will be fallbacks in case there is no image for the icon. We will only be providing fallbacks for a very limited number of icons, which we still need to determine.

But, give it a play and let us know what you think.