mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 17:41:41 +01:00
TerminalFont: don't use singleton
Singleton doesn't work well with JSON config
This commit is contained in:
@@ -374,20 +374,18 @@ static bool detectTerminalFontCommon(const FFinstance* instance, const FFTermina
|
||||
return true;
|
||||
}
|
||||
|
||||
const FFTerminalFontResult* ffDetectTerminalFont(const FFinstance* instance)
|
||||
bool ffDetectTerminalFont(const FFinstance* instance, FFTerminalFontResult* result)
|
||||
{
|
||||
FF_DETECTION_INTERNAL_GUARD(FFTerminalFontResult,
|
||||
ffStrbufInit(&result.error);
|
||||
const FFTerminalShellResult* terminalShell = ffDetectTerminalShell(instance);
|
||||
|
||||
const FFTerminalShellResult* terminalShell = ffDetectTerminalShell(instance);
|
||||
if(terminalShell->terminalProcessName.length == 0)
|
||||
ffStrbufAppendS(&result->error, "Terminal font needs successful terminal detection");
|
||||
|
||||
if(terminalShell->terminalProcessName.length == 0)
|
||||
ffStrbufAppendS(&result.error, "Terminal font needs successful terminal detection");
|
||||
else if(!detectTerminalFontCommon(instance, terminalShell, result))
|
||||
ffDetectTerminalFontPlatform(instance, terminalShell, result);
|
||||
|
||||
else if(!detectTerminalFontCommon(instance, terminalShell, &result))
|
||||
ffDetectTerminalFontPlatform(instance, terminalShell, &result);
|
||||
if(result->error.length == 0 && result->font.pretty.length == 0)
|
||||
ffStrbufAppendF(&result->error, "Unknown terminal: %s", terminalShell->terminalProcessName.chars);
|
||||
|
||||
if(result.error.length == 0 && result.font.pretty.length == 0)
|
||||
ffStrbufAppendF(&result.error, "Unknown terminal: %s", terminalShell->terminalProcessName.chars);
|
||||
);
|
||||
return result->error.length == 0;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,6 @@ typedef struct FFTerminalFontResult
|
||||
FFfont font;
|
||||
} FFTerminalFontResult;
|
||||
|
||||
const FFTerminalFontResult* ffDetectTerminalFont(const FFinstance* instance);
|
||||
bool ffDetectTerminalFont(const FFinstance* instance, FFTerminalFontResult* result);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user