Fix odering of XDG_CONFIG_DIRS

This commit is contained in:
Linus Dierheimer
2021-10-22 18:42:14 +02:00
parent 3923f11a45
commit e18199e8ec
3 changed files with 23 additions and 19 deletions
+7 -4
View File
@@ -41,14 +41,17 @@ static bool detectFromConfigFile(const FFstrbuf* filename, FFPlasmaResult* resul
continue;
}
if(category == PLASMA_CATEGORY_KDE)
if(category == PLASMA_CATEGORY_KDE && result->widgetStyle.length == 0)
ffGetPropValue(line, "widgetStyle =", &result->widgetStyle);
else if(category == PLASMA_CATEGORY_ICONS)
else if(category == PLASMA_CATEGORY_ICONS && result->icons.length == 0)
ffGetPropValue(line, "Theme =", &result->icons);
else if(category == PLASMA_CATEGORY_GENERAL)
{
ffGetPropValue(line, "ColorScheme =", &result->colorScheme);
ffGetPropValue(line, "font =", &result->font);
if(result->colorScheme.length == 0)
ffGetPropValue(line, "ColorScheme =", &result->colorScheme);
if(result->font.length == 0)
ffGetPropValue(line, "Font =", &result->font);
}
}
+15 -14
View File
@@ -25,20 +25,6 @@ static void initConfigDirs(FFstate* state)
ffStrbufInitA(&xdgConfigDirs, 64);
ffStrbufAppendS(&xdgConfigDirs, getenv("XDG_CONFIG_DIRS"));
uint32_t startIndex = 0;
while (startIndex < xdgConfigDirs.length)
{
uint32_t colonIndex = ffStrbufNextIndexC(&xdgConfigDirs, startIndex, ':');
xdgConfigDirs.chars[colonIndex] = '\0';
FFstrbuf* buffer = (FFstrbuf*) ffListAdd(&state->configDirs);
ffStrbufInitA(buffer, 64);
ffStrbufAppendS(buffer, xdgConfigDirs.chars + startIndex);
ffStrbufTrimRight(buffer, '/');
startIndex = colonIndex + 1;
}
#define FF_ENSURE_ONLY_ONCE_IN_LIST(element) \
if(ffListFirstIndexComp(&state->configDirs, element, strbufEqualsAdapter) < state->configDirs.length - 1) \
--state->configDirs.length;
@@ -54,6 +40,21 @@ static void initConfigDirs(FFstate* state)
ffStrbufAppendS(userHome, state->passwd->pw_dir);
FF_ENSURE_ONLY_ONCE_IN_LIST(userHome)
uint32_t startIndex = 0;
while (startIndex < xdgConfigDirs.length)
{
uint32_t colonIndex = ffStrbufNextIndexC(&xdgConfigDirs, startIndex, ':');
xdgConfigDirs.chars[colonIndex] = '\0';
FFstrbuf* buffer = (FFstrbuf*) ffListAdd(&state->configDirs);
ffStrbufInitA(buffer, 64);
ffStrbufAppendS(buffer, xdgConfigDirs.chars + startIndex);
ffStrbufTrimRight(buffer, '/');
FF_ENSURE_ONLY_ONCE_IN_LIST(buffer);
startIndex = colonIndex + 1;
}
FFstrbuf* systemConfigHome = ffListAdd(&state->configDirs);
ffStrbufInitA(systemConfigHome, 64);
ffStrbufAppendS(systemConfigHome, "/etc/xdg");
+1 -1
View File
@@ -310,7 +310,7 @@ void ffLoadLogo(FFinstance* instance);
void ffPrintLogoLine(FFinstance* instance);
void ffPrintRemainingLogo(FFinstance* instance);
#ifndef FLASHFETCH_BUILD_FLASHFATCH
#ifndef FASTFETCH_BUILD_FLASHFATCH
void ffListLogos();
void ffPrintLogos(FFinstance* instance);
#endif