From 0ae1ecc05fe6cf958b1cf0a3fadb6b99face62d4 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 10 May 2000 12:30:34 +0000 Subject: [PATCH] Made the floppy path in the file panel be configurable via the FloppyPath key in the WMGLOBAL file, instead of the '/floppy' hardcoded value. --- WINGs/WINGsP.h | 1 + WINGs/configuration.c | 8 ++++++++ WINGs/wfilepanel.c | 15 ++++++--------- WindowMaker/Defaults/WMGLOBAL | 1 + 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/WINGs/WINGsP.h b/WINGs/WINGsP.h index b017885c..48cdf428 100644 --- a/WINGs/WINGsP.h +++ b/WINGs/WINGsP.h @@ -389,6 +389,7 @@ typedef struct _WINGsConfiguration { char *boldSystemFont; int defaultFontSize; Bool useMultiByte; + char *floppyPath; unsigned doubleClickDelay; unsigned mouseWheelUp; unsigned mouseWheelDown; diff --git a/WINGs/configuration.c b/WINGs/configuration.c index 7d9bb1f7..3df6d5bc 100644 --- a/WINGs/configuration.c +++ b/WINGs/configuration.c @@ -13,6 +13,8 @@ _WINGsConfiguration WINGsConfiguration; #define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*" +#define FLOPPY_PATH "/floppy" + static unsigned getButtonWithName(const char *name, unsigned defaultButton) @@ -63,6 +65,9 @@ W_ReadConfigurations(void) WINGsConfiguration.doubleClickDelay = WMGetUDIntegerForKey(defaults, "DoubleClickTime"); + WINGsConfiguration.floppyPath = + WMGetUDStringForKey(defaults, "FloppyPath"); + buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp"); if (buttonName) { button = getButtonWithName(buttonName, Button4); @@ -97,6 +102,9 @@ W_ReadConfigurations(void) if (!WINGsConfiguration.boldSystemFont) { WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT; } + if (!WINGsConfiguration.floppyPath) { + WINGsConfiguration.floppyPath = FLOPPY_PATH; + } if (WINGsConfiguration.doubleClickDelay == 0) { WINGsConfiguration.doubleClickDelay = 250; } diff --git a/WINGs/wfilepanel.c b/WINGs/wfilepanel.c index 6852020c..ce53974a 100644 --- a/WINGs/wfilepanel.c +++ b/WINGs/wfilepanel.c @@ -12,9 +12,6 @@ #define PATH_MAX 1024 #endif -#ifndef FLOPPY_PATH -#define FLOPPY_PATH "/floppy" -#endif typedef struct W_FilePanel { WMWindow *win; @@ -846,20 +843,20 @@ goUnmount(WMButton *bPtr, WMFilePanel *panel) static void goFloppy(WMButton *bPtr, WMFilePanel *panel) { - char *file; struct stat filestat; WMScreen *scr = WMWidgetScreen(panel->win); - file = FLOPPY_PATH; - if (stat(FLOPPY_PATH,&filestat)) { - showError(scr, panel->win, "An error occured browsing '%s'.", file); + if (stat(WINGsConfiguration.floppyPath, &filestat)) { + showError(scr, panel->win, "An error occured browsing '%s'.", + WINGsConfiguration.floppyPath); return; } else if (!S_ISDIR(filestat.st_mode)) { - showError(scr, panel->win, "'%s' is not a directory.", file); + showError(scr, panel->win, "'%s' is not a directory.", + WINGsConfiguration.floppyPath); return; } - WMSetFilePanelDirectory(panel, FLOPPY_PATH); + WMSetFilePanelDirectory(panel, WINGsConfiguration.floppyPath); } diff --git a/WindowMaker/Defaults/WMGLOBAL b/WindowMaker/Defaults/WMGLOBAL index 182a08a1..834e8834 100644 --- a/WindowMaker/Defaults/WMGLOBAL +++ b/WindowMaker/Defaults/WMGLOBAL @@ -1,6 +1,7 @@ { SystemFont = "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*"; BoldSystemFont = "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*"; + FloppyPath = "/floppy"; MultiByteText = NO; DoubleClickTime = 250; MouseWheelUp = Button4;