mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Remove old backward compatibility code
Once upon a time (< 2005) the CachedPixmaps directory was located
at ~/GNUstep/.AppInfo/ and that was later moved to
~/GNUstep/Library/WindowMaker. So Dan Pascu introduced this function
in 24519b6292 to make the convertion
automatically to users back then.
As it is highly unlikely that there is an old-timer wmaker user still
running a pre-2005 wmaker which suddenly decides to switch to wmaker-crm
and runs into trouble with his CachedPixmaps folder, let's simply remove it
to make defaults.o 1.8% smaller (596 bytes).
This commit is contained in:
@@ -770,51 +770,6 @@ static void appendMenu(WMPropList * destarr, WMPropList * array)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fixup paths for cached pixmaps from .AppInfo to Library/WindowMaker/... */
|
|
||||||
static Bool fixupCachedPixmapsPaths(WMPropList * dict)
|
|
||||||
{
|
|
||||||
WMPropList *allApps, *app, *props, *iconkey, *icon, *newicon;
|
|
||||||
char *path, *fixedpath, *ptr, *search;
|
|
||||||
int i, len, slen;
|
|
||||||
Bool changed = False;
|
|
||||||
|
|
||||||
search = "/.AppInfo/WindowMaker/";
|
|
||||||
slen = strlen(search);
|
|
||||||
|
|
||||||
iconkey = WMCreatePLString("Icon");
|
|
||||||
allApps = WMGetPLDictionaryKeys(dict);
|
|
||||||
|
|
||||||
for (i = 0; i < WMGetPropListItemCount(allApps); i++) {
|
|
||||||
app = WMGetFromPLArray(allApps, i);
|
|
||||||
props = WMGetFromPLDictionary(dict, app);
|
|
||||||
if (!props)
|
|
||||||
continue;
|
|
||||||
icon = WMGetFromPLDictionary(props, iconkey);
|
|
||||||
if (icon && WMIsPLString(icon)) {
|
|
||||||
path = WMGetFromPLString(icon);
|
|
||||||
ptr = strstr(path, search);
|
|
||||||
if (ptr) {
|
|
||||||
changed = True;
|
|
||||||
len = (ptr - path);
|
|
||||||
fixedpath = wmalloc(strlen(path) + 32);
|
|
||||||
strncpy(fixedpath, path, len);
|
|
||||||
fixedpath[len] = 0;
|
|
||||||
strcat(fixedpath, "/Library/WindowMaker/CachedPixmaps/");
|
|
||||||
strcat(fixedpath, ptr + slen);
|
|
||||||
newicon = WMCreatePLString(fixedpath);
|
|
||||||
WMPutInPLDictionary(props, iconkey, newicon);
|
|
||||||
WMReleasePropList(newicon);
|
|
||||||
wfree(fixedpath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WMReleasePropList(allApps);
|
|
||||||
WMReleasePropList(iconkey);
|
|
||||||
|
|
||||||
return changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wDefaultsMergeGlobalMenus(WDDomain * menuDomain)
|
void wDefaultsMergeGlobalMenus(WDDomain * menuDomain)
|
||||||
{
|
{
|
||||||
WMPropList *menu = menuDomain->dictionary;
|
WMPropList *menu = menuDomain->dictionary;
|
||||||
@@ -909,15 +864,6 @@ WDDomain *wDefaultsInitDomain(char *domain, Bool requireDictionary)
|
|||||||
db->dictionary = NULL;
|
db->dictionary = NULL;
|
||||||
wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain, the_path);
|
wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain, the_path);
|
||||||
}
|
}
|
||||||
if (strcmp(domain, "WMWindowAttributes") == 0 && db->dictionary) {
|
|
||||||
if (fixupCachedPixmapsPaths(db->dictionary)) {
|
|
||||||
WMWritePropListToFile(db->dictionary, db->path, True);
|
|
||||||
/* re-read the timestamp. if this fails take current time */
|
|
||||||
if (stat(db->path, &stbuf) < 0) {
|
|
||||||
stbuf.st_mtime = time(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
db->timestamp = stbuf.st_mtime;
|
db->timestamp = stbuf.st_mtime;
|
||||||
} else {
|
} else {
|
||||||
wwarning(_("could not load domain %s from user defaults database"), domain);
|
wwarning(_("could not load domain %s from user defaults database"), domain);
|
||||||
|
|||||||
Reference in New Issue
Block a user