better ffSettings* functions

This commit is contained in:
Linus Dierheimer
2021-05-11 20:06:17 +02:00
parent 97ab892051
commit 039b69f4a7
7 changed files with 149 additions and 84 deletions
+18 -5
View File
@@ -46,10 +46,10 @@ static void printWMThemeFromConfigFile(FFinstance* instance, const char* configF
static void printMutter(FFinstance* instance)
{
const char* theme = ffSettingsGetStr(instance, "/org/gnome/shell/extensions/user-theme/name", "org.gnome.shell.extensions.user-theme", NULL, "name");
const char* theme = ffSettingsGet(instance, "/org/gnome/shell/extensions/user-theme/name", "org.gnome.shell.extensions.user-theme", NULL, "name", FF_VARIANT_TYPE_STRING).strValue;
if(theme == NULL)
theme = ffSettingsGetStr(instance, "/org/gnome/desktop/wm/preferences/theme", "org.gnome.desktop.wm.preferences", NULL, "theme");
theme = ffSettingsGet(instance, "/org/gnome/desktop/wm/preferences/theme", "org.gnome.desktop.wm.preferences", NULL, "theme", FF_VARIANT_TYPE_STRING).strValue;
if(theme == NULL)
{
@@ -62,8 +62,8 @@ static void printMutter(FFinstance* instance)
static void printMuffin(FFinstance* instance)
{
const char* name = ffSettingsGetStr(instance, "/org/cinnamon/theme/name", "org.cinnamon.theme", NULL, "name");
const char* theme = ffSettingsGetStr(instance, "/org/cinnamon/desktop/wm/preferences/theme", "org.cinnamon.desktop.wm.preferences", NULL, "theme");
const char* name = ffSettingsGet(instance, "/org/cinnamon/theme/name", "org.cinnamon.theme", NULL, "name", FF_VARIANT_TYPE_STRING).strValue;
const char* theme = ffSettingsGet(instance, "/org/cinnamon/desktop/wm/preferences/theme", "org.cinnamon.desktop.wm.preferences", NULL, "theme", FF_VARIANT_TYPE_STRING).strValue;
if(name == NULL && theme == NULL)
{
@@ -90,6 +90,19 @@ static void printMuffin(FFinstance* instance)
}
}
static void printXFWM4(FFinstance* instance)
{
const char* theme = ffSettingsGetXFConf(instance, "xfwm4", "/general/theme", FF_VARIANT_TYPE_STRING).strValue;
if(theme == NULL)
{
ffPrintError(instance, FF_WMTHEME_MODULE_NAME, 0, &instance->config.wmThemeKey, &instance->config.wmThemeFormat, FF_WMTHEME_NUM_FORMAT_ARGS, "Couldn't find xfwm4::/general/theme in XFConf");
return;
}
printWMTheme(instance, theme);
}
static void printOpenbox(FFinstance* instance, const FFstrbuf* dePrettyName)
{
FFstrbuf absolutePath;
@@ -167,7 +180,7 @@ void ffPrintWMTheme(FFinstance* instance)
if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "KWin") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "KDE") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Plasma") == 0)
printWMThemeFromConfigFile(instance, "kwinrc", " theme=%s", "Breeze");
else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Xfwm4") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Xfwm") == 0)
printWMThemeFromConfigFile(instance, "xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml", " <property name=\"theme\" type=\"string\" value=\"%[^\"]", "Default");
printXFWM4(instance);
else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Mutter") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Gnome") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Ubuntu") == 0)
printMutter(instance);
else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Muffin") == 0)