clapper: Store enhancers settings in separate config file

By enforcing keyfile GSettings backend with a custom file path,
we can store all enhancers settings within known location.
It makes it much easier to share them in between apps in Flatpak.
This commit is contained in:
Rafał Dzięgiel
2025-08-11 17:24:55 +02:00
parent d2ceb962f1
commit 659de80741
2 changed files with 14 additions and 2 deletions

View File

@@ -41,6 +41,7 @@
#include "config.h"
#include <gobject/gvaluecollector.h>
#include <gio/gsettingsbackend.h>
#include "clapper-enhancer-proxy-private.h"
#include "clapper-enhancer-proxy-list.h"
@@ -896,8 +897,18 @@ clapper_enhancer_proxy_get_settings (ClapperEnhancerProxy *self)
/* Try to lazy load schemas */
_init_schema (self);
if (self->schema)
settings = g_settings_new_full (self->schema, NULL, NULL);
if (self->schema) {
GSettingsBackend *backend;
gchar *filename;
filename = g_build_filename (g_get_user_config_dir (),
CLAPPER_API_NAME, "enhancers", "keyfile", NULL);
backend = g_keyfile_settings_backend_new (filename, "/", NULL);
g_free (filename);
settings = g_settings_new_full (self->schema, backend, NULL);
g_object_unref (backend);
}
return settings;
}

View File

@@ -172,6 +172,7 @@ clapper_c_args = [
'-DG_LOG_DOMAIN="Clapper"',
'-DCLAPPER_COMPILATION',
'-DGST_USE_UNSTABLE_API',
'-DG_SETTINGS_ENABLE_BACKEND',
]
if get_option('default_library') == 'static'