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

Remove code duplication by calling readGlobalDomain()

The code in defaults.c to get the shared database is
included in the same file (function readGlobalDomain).
This commit is contained in:
Rodolfo García Peñas (kix)
2012-06-06 12:34:36 +02:00
committed by Carlos R. Mafra
parent f8291de919
commit 1a594de74e

View File

@@ -803,7 +803,6 @@ WDDomain *wDefaultsInitDomain(char *domain, Bool requireDictionary)
WDDomain *db; WDDomain *db;
struct stat stbuf; struct stat stbuf;
static int inited = 0; static int inited = 0;
char path[PATH_MAX];
char *the_path; char *the_path;
WMPropList *shared_dict = NULL; WMPropList *shared_dict = NULL;
@@ -832,17 +831,9 @@ WDDomain *wDefaultsInitDomain(char *domain, Bool requireDictionary)
} }
/* global system dictionary */ /* global system dictionary */
snprintf(path, sizeof(path), "%s/%s/%s", SYSCONFDIR, GLOBAL_DEFAULTS_SUBDIR, domain); shared_dict = readGlobalDomain(domain, requireDictionary);
if (stat(path, &stbuf) >= 0) {
shared_dict = WMReadPropListFromFile(path); if (shared_dict && db->dictionary && WMIsPLDictionary(shared_dict) &&
if (shared_dict) {
if (requireDictionary && !WMIsPLDictionary(shared_dict)) {
wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
domain, path);
WMReleasePropList(shared_dict);
shared_dict = NULL;
} else {
if (db->dictionary && WMIsPLDictionary(shared_dict) &&
WMIsPLDictionary(db->dictionary)) { WMIsPLDictionary(db->dictionary)) {
WMMergePLDictionaries(shared_dict, db->dictionary, True); WMMergePLDictionaries(shared_dict, db->dictionary, True);
WMReleasePropList(db->dictionary); WMReleasePropList(db->dictionary);
@@ -854,11 +845,6 @@ WDDomain *wDefaultsInitDomain(char *domain, Bool requireDictionary)
if (stbuf.st_mtime > db->timestamp) if (stbuf.st_mtime > db->timestamp)
db->timestamp = stbuf.st_mtime; db->timestamp = stbuf.st_mtime;
} }
}
} else {
wwarning(_("could not load domain %s from global defaults database (%s)"), domain, path);
}
}
return db; return db;
} }