WPrefs: WINGs font configuration

This patch allows users to edit the two fonts (SystemFont and BoldSystemFont)
used in WINGs widgets using WPrefs.  Note that changes will not take effect for
WINGs applications which are currently running.
This commit is contained in:
Doug Torrance authored and Carlos R. Mafra committed 2014-05-17 15:59:47 +01:00
1 parent 0a30d42eaa
commit d9b15a2311
1 file changed
+30 -2
+30 -2
View File
@@ -102,6 +102,8 @@ static const struct {
"IconTitleFont", N_("Icon Title")}, {
"ClipTitleFont", N_("Clip Title")}, {
"LargeDisplayFont", N_("Desktop Caption")}, {
"SystemFont", N_("System Font")}, {
"BoldSystemFont", N_("Bold System Font")}, {
NULL, NULL},};
static const char *standardSizes[] = {
@@ -587,7 +589,19 @@ static void showData(_Panel * panel)
if (ofont)
wfree(ofont);
font = GetStringForKey(fontOptions[i].option);
if (strcmp(fontOptions[i].option, "SystemFont") == 0 ||
strcmp(fontOptions[i].option, "BoldSystemFont") == 0) {
char *path;
WMUserDefaults *defaults;
path = wdefaultspathfordomain("WMGLOBAL");
defaults = WMGetDefaultsFromPath(path);
wfree(path);
font = WMGetUDStringForKey(defaults,
fontOptions[i].option);
} else {
font = GetStringForKey(fontOptions[i].option);
}
if (font)
font = wstrdup(font);
WMSetMenuItemRepresentedObject(item, font);
@@ -608,7 +622,21 @@ static void storeData(_Panel * panel)
font = WMGetMenuItemRepresentedObject(item);
if (font && *font) {
SetStringForKey(font, fontOptions[i].option);
if (strcmp(fontOptions[i].option, "SystemFont") == 0 ||
strcmp(fontOptions[i].option, "BoldSystemFont") == 0) {
char *path;
WMUserDefaults *defaults;
path = wdefaultspathfordomain("WMGLOBAL");
defaults = WMGetDefaultsFromPath(path);
wfree(path);
WMSetUDStringForKey(defaults,
font,
fontOptions[i].option);
WMSaveUserDefaults(defaults);
} else {
SetStringForKey(font, fontOptions[i].option);
}
}
}
}