mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 04:48:06 +01:00
Added code to automatically convert Icon paths in WMWindowAttributes from
the old .AppInfo/... to the new Library/WindowMaker/... on the fly when Window Maker starts. This should allow a transparent transition without any need for users to do anything.
This commit is contained in:
@@ -14,6 +14,9 @@ Changes since version 0.91.0:
|
|||||||
- fixed to allow parallel builds on SMP systems using make -j
|
- fixed to allow parallel builds on SMP systems using make -j
|
||||||
- updated Italian translation (Marco Colombo <m.colombo@ed.ac.uk>)
|
- updated Italian translation (Marco Colombo <m.colombo@ed.ac.uk>)
|
||||||
- applied .AppInfo --> Library path rename patch (Alex Perez <aperez@student.santarosa.edu>)
|
- applied .AppInfo --> Library path rename patch (Alex Perez <aperez@student.santarosa.edu>)
|
||||||
|
- added code to automatically update the icon paths from the old .AppInfo
|
||||||
|
style to the new Library/WindowMaker style in WMWindowAttributes when
|
||||||
|
Window Maker starts to make transition transparent for users.
|
||||||
|
|
||||||
|
|
||||||
Changes since version 0.90.0:
|
Changes since version 0.90.0:
|
||||||
|
|||||||
@@ -971,6 +971,53 @@ 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, *replace;
|
||||||
|
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
|
void
|
||||||
wDefaultsMergeGlobalMenus(WDDomain *menuDomain)
|
wDefaultsMergeGlobalMenus(WDDomain *menuDomain)
|
||||||
{
|
{
|
||||||
@@ -1076,6 +1123,15 @@ wDefaultsInitDomain(char *domain, Bool requireDictionary)
|
|||||||
wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
|
wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
|
||||||
domain, the_path);
|
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"),
|
wwarning(_("could not load domain %s from user defaults database"),
|
||||||
|
|||||||
Reference in New Issue
Block a user