mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
JsonConfig: refactor to get rid of data-ffjson_*
This commit is contained in:
@@ -80,7 +80,7 @@ void ffDestroyBrightnessOptions(FFBrightnessOptions* options)
|
||||
}
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
bool ffParseBrightnessJsonObject(FFinstance* instance, const char* type, JSONCData* data, json_object* module)
|
||||
bool ffParseBrightnessJsonObject(FFinstance* instance, const char* type, json_object* module)
|
||||
{
|
||||
if (strcasecmp(type, FF_BRIGHTNESS_MODULE_NAME) != 0)
|
||||
return false;
|
||||
@@ -88,15 +88,18 @@ bool ffParseBrightnessJsonObject(FFinstance* instance, const char* type, JSONCDa
|
||||
FFBrightnessOptions __attribute__((__cleanup__(ffDestroyBrightnessOptions))) options;
|
||||
ffInitBrightnessOptions(&options);
|
||||
|
||||
FF_JSON_OBJECT_OBJECT_FOREACH(data, module, key, val)
|
||||
if (module)
|
||||
{
|
||||
if (strcasecmp(key, "type") == 0)
|
||||
continue;
|
||||
json_object_object_foreach(module, key, val)
|
||||
{
|
||||
if (strcasecmp(key, "type") == 0)
|
||||
continue;
|
||||
|
||||
if (ffJsonConfigParseModuleArgs(data, key, val, &options.moduleArgs))
|
||||
continue;
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(instance, FF_BRIGHTNESS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(instance, FF_BRIGHTNESS_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintBrightness(instance, &options);
|
||||
|
||||
@@ -8,6 +8,6 @@ bool ffParseBrightnessCommandOptions(FFBrightnessOptions* options, const char* k
|
||||
void ffDestroyBrightnessOptions(FFBrightnessOptions* options);
|
||||
|
||||
#ifdef FF_HAVE_JSONC
|
||||
#include "common/config.h"
|
||||
bool ffParseBrightnessJsonObject(FFinstance* instance, const char* type, JSONCData* data, json_object* module);
|
||||
#include "common/jsonconfig.h"
|
||||
bool ffParseBrightnessJsonObject(FFinstance* instance, const char* type, json_object* module);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user