1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00

Remove dup code from getWindowMakerIconImage()

The code to find the icon in the function getWindowMakerIconImage()
is duplicated, because it is the same code as in get_default_icon_filename()

This patch includes the prototypes of get_default_icon_filename()
and get_default_icon_rimage() in defaults.h, so these functions
can be used in other files.
This commit is contained in:
Rodolfo García Peñas (kix)
2012-07-03 12:43:02 +02:00
committed by Carlos R. Mafra
parent 76e8a8f963
commit 39fa6d9e2c
2 changed files with 14 additions and 33 deletions

View File

@@ -1461,45 +1461,23 @@ static void setCrashAction(void *self, void *clientData)
}
/* Make this read the logo from a compiled in pixmap -Dan */
static WMPixmap *getWindowMakerIconImage(WMScreen * scr)
static WMPixmap *getWindowMakerIconImage(WMScreen *scr)
{
WMPropList *dict, *key, *option, *value = NULL;
WMPixmap *pix = NULL;
char *path;
char *path = NULL;
if (!WDWindowAttributes || !WDWindowAttributes->dictionary)
return NULL;
path = get_default_icon_filename(NULL, "Logo", "WMPanel", NULL, True);
WMPLSetCaseSensitive(True);
if (path) {
RColor gray;
key = WMCreatePLString("Logo.WMPanel");
option = WMCreatePLString("Icon");
gray.red = 0xae;
gray.green = 0xaa;
gray.blue = 0xae;
gray.alpha = 0;
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
if (dict) {
value = WMGetFromPLDictionary(dict, option);
}
WMReleasePropList(key);
WMReleasePropList(option);
WMPLSetCaseSensitive(False);
if (value && WMIsPLString(value)) {
path = FindImage(wPreferences.icon_path, WMGetFromPLString(value));
if (path) {
RColor gray;
gray.red = 0xae;
gray.green = 0xaa;
gray.blue = 0xae;
gray.alpha = 0;
pix = WMCreateBlendedPixmapFromFile(scr, path, &gray);
wfree(path);
}
pix = WMCreateBlendedPixmapFromFile(scr, path, &gray);
wfree(path);
}
return pix;