mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-24 15:12:32 +01:00
configure: Add option to specify global defaults directory.
Previously, this was only (partially) possible by redefining the macro GLOBAL_DEFAULTS_SUBDIR. This told Window Maker to look for the global config files in a particular subdirectory of SYSCONFDIR. However: * This is undocumented. * GLOBAL_DEFAULTS_SUBDIR is ignored when installing the config files. They are always installed to SYSCONFDIR/WindowMaker. To solve these issues, we add a "--with-defsdatadir" option to configure which allows a user to specify the global defaults directory.
This commit is contained in:
committed by
Carlos R. Mafra
parent
ac92f1a844
commit
6fa1c0c009
@@ -67,11 +67,6 @@
|
||||
|
||||
#define MAX_SHORTCUT_LENGTH 32
|
||||
|
||||
#ifndef GLOBAL_DEFAULTS_SUBDIR
|
||||
#define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _WDefaultEntry WDefaultEntry;
|
||||
typedef int (WDECallbackConvert) (WScreen *scr, WDefaultEntry *entry, WMPropList *plvalue, void *addr, void **tdata);
|
||||
typedef int (WDECallbackUpdate) (WScreen *scr, WDefaultEntry *entry, void *tdata, void *extra_data);
|
||||
@@ -879,7 +874,7 @@ static WMPropList *readGlobalDomain(const char *domainName, Bool requireDictiona
|
||||
char path[PATH_MAX];
|
||||
struct stat stbuf;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s/%s", SYSCONFDIR, GLOBAL_DEFAULTS_SUBDIR, domainName);
|
||||
snprintf(path, sizeof(path), "%s/%s", DEFSDATADIR, domainName);
|
||||
if (stat(path, &stbuf) >= 0) {
|
||||
globalDict = WMReadPropListFromFile(path);
|
||||
if (globalDict && requireDictionary && !WMIsPLDictionary(globalDict)) {
|
||||
@@ -929,7 +924,7 @@ void wDefaultsMergeGlobalMenus(WDDomain * menuDomain)
|
||||
return;
|
||||
|
||||
#ifdef GLOBAL_PREAMBLE_MENU_FILE
|
||||
submenu = WMReadPropListFromFile(SYSCONFDIR "/" GLOBAL_DEFAULTS_SUBDIR "/" GLOBAL_PREAMBLE_MENU_FILE);
|
||||
submenu = WMReadPropListFromFile(DEFSDATADIR "/" GLOBAL_PREAMBLE_MENU_FILE);
|
||||
|
||||
if (submenu && !WMIsPLArray(submenu)) {
|
||||
wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE);
|
||||
@@ -943,7 +938,7 @@ void wDefaultsMergeGlobalMenus(WDDomain * menuDomain)
|
||||
#endif
|
||||
|
||||
#ifdef GLOBAL_EPILOGUE_MENU_FILE
|
||||
submenu = WMReadPropListFromFile(SYSCONFDIR "/" GLOBAL_DEFAULTS_SUBDIR "/" GLOBAL_EPILOGUE_MENU_FILE);
|
||||
submenu = WMReadPropListFromFile(DEFSDATADIR "/" GLOBAL_EPILOGUE_MENU_FILE);
|
||||
|
||||
if (submenu && !WMIsPLArray(submenu)) {
|
||||
wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE);
|
||||
|
||||
@@ -59,10 +59,6 @@
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
#ifndef GLOBAL_DEFAULTS_SUBDIR
|
||||
#define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
|
||||
#endif
|
||||
|
||||
/****** Global Variables ******/
|
||||
struct wmaker_global_variables w_global;
|
||||
|
||||
@@ -662,7 +658,7 @@ static int real_main(int argc, char **argv)
|
||||
printf("Window Maker %s\n", VERSION);
|
||||
exit(0);
|
||||
} else if (strcmp(argv[i], "--global_defaults_path") == 0) {
|
||||
printf("%s/%s\n", SYSCONFDIR, GLOBAL_DEFAULTS_SUBDIR);
|
||||
printf("%s\n", DEFSDATADIR);
|
||||
exit(0);
|
||||
} else if (strcmp(argv[i], "-locale") == 0 || strcmp(argv[i], "--locale") == 0) {
|
||||
i++;
|
||||
|
||||
@@ -1017,7 +1017,7 @@ Bool UpdateDomainFile(WDDomain * domain)
|
||||
dict = domain->dictionary;
|
||||
if (WMIsPLDictionary(domain->dictionary)) {
|
||||
/* retrieve global system dictionary */
|
||||
snprintf(path, sizeof(path), "%s/WindowMaker/%s", SYSCONFDIR, domain->domain_name);
|
||||
snprintf(path, sizeof(path), "%s/%s", DEFSDATADIR, domain->domain_name);
|
||||
if (stat(path, &stbuf) >= 0) {
|
||||
shared_dict = WMReadPropListFromFile(path);
|
||||
if (shared_dict) {
|
||||
|
||||
Reference in New Issue
Block a user