Solved bug if icon doesn't exists
commit529276a3956e4d3ab9091eeaddc0416c8b194c06
authorRodolfo García Peñas (kix) <kix@kix.es>
Sat, 3 Nov 2012 18:54:02 +0000 (3 19:54 +0100)
committerCarlos R. Mafra <crmafra@gmail.com>
Sun, 4 Nov 2012 12:54:15 +0000 (4 12:54 +0000)
tree626475fb3da44501dd5010c04e027dec7984def4
parent314f1dc9070433a18f914ab3bbc04599c9eabdca
Solved bug if icon doesn't exists

There is a bug in wmaker with icon files set in config files, but
that doesn't exist in the disk. For example, if the config files have:

etc/WindowMaker/WMWindowAttributes:
  xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};
share/WindowMaker/IconSets/Default.iconset:
  xcalc = {AlwaysUserIcon = Yes;Icon = "HP-16C-48.xpm";};

But the icon "HP-16C-48.xpm" doesn't exist in the disk, wmaker does:

1. Load the config file in memory, in a database
2. When the application is launched, wmaker tries to find their icon in
   the database (using wDefaultGetIconFile), the icon is found: HP-16C-48.xpm
3. When WindowMaker try to find the full path for the icon, using FindImage(),
   WindowMaker cannot find the icon, and returns NULL.
   Even, if the user set the default_icon boolean variable to True, wmaker
   finds in the database the wrong icon.

This patch checks that the icon exists both in the database AND in the disk. If the
icon doesn't exist in the disk and the default_icon variable is set to True,
then windowmaker loads the default icon using the function get_default_image()
because this function searches the default icon directly.

The function get_default_image() is moved from icon.c to wdefaults.c because
it is now used in both places. This function is now splitted, to find the file
(get_default_image_path) path and the file image (get_default_image)
src/defaults.h
src/icon.c
src/wdefaults.c