1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-27 00:42:32 +01:00

get_default_icon_filename rewritten

The function get_default_icon_filename(), now get_icon_filename(),
was working in a bad way. Before this patch, the function always
searched the default icon in the second search:

-     file_name = wDefaultGetIconFile(winstance, wclass, True);
+     file_name = wDefaultGetIconFile(winstance, wclass, False);

For this reason, the argument default_icon didn't work.

This patch change it. Now, if the default_icon is false, the function
can return NULL, then other functions can do the correct work. For
example, now wDefaultGetImage() doesn't need do nothing, because the
default_icon is set to True. get_icon_filename() checks if the
icon exists in the disk before returning it (except for default icon
in get_default_image_path(scr).
This commit is contained in:
Rodolfo García Peñas (kix)
2012-11-10 19:25:54 +01:00
committed by Carlos R. Mafra
parent 6bc48464e9
commit c3a1c76b44
4 changed files with 14 additions and 29 deletions

View File

@@ -144,7 +144,7 @@ WIcon *icon_create_for_wwindow(WWindow *wwin)
wGetIconName(dpy, wwin->client_win, &icon->icon_name);
/* Get the application icon, default included */
file = get_default_icon_filename(scr, wwin->wm_instance, wwin->wm_class, NULL, True);
file = get_icon_filename(scr, wwin->wm_instance, wwin->wm_class, NULL, True);
if (file) {
icon->file = wstrdup(file);
icon->file_image = get_rimage_from_file(scr, icon->file, wPreferences.icon_size);
@@ -169,7 +169,7 @@ WIcon *icon_create_for_dock(WScreen *scr, char *command, char *wm_instance, char
icon = icon_create_core(scr, 0, 0);
/* Search the icon using instance and class, without default icon */
file = get_default_icon_filename(scr, wm_instance, wm_class, command, False);
file = get_icon_filename(scr, wm_instance, wm_class, command, False);
if (file) {
icon->file = wstrdup(file);
icon->file_image = get_rimage_from_file(scr, icon->file, wPreferences.icon_size);