diff options
author | Gary Kramlich <grim@reaperworld.com> | 2022-10-10 02:30:03 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2022-10-10 02:30:03 -0500 |
commit | e1762daf23571a1d613535475c5b70b5376a77f7 (patch) | |
tree | 5736da8b3abe5b68fc773c51b6dc10e3e52313c3 /finch/libfinch.c | |
parent | 123e4b523cae989f3128ec1e69cf72950ca812f2 (diff) | |
download | pidgin-e1762daf23571a1d613535475c5b70b5376a77f7.tar.gz |
Add a get_settings_backend vfunc to CoreUiOps
This allows the user interface to declare their own settings backend. There's
some minor duplication between finch and pidgin for this, but this means the
test ui can use a memory backend instead of something on disk.
Testing Done:
Ran the unit tests multiple times and verified that the credential manager test stops messing up everything else.
Reviewed at https://reviews.imfreedom.org/r/1921/
Diffstat (limited to 'finch/libfinch.c')
-rw-r--r-- | finch/libfinch.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/finch/libfinch.c b/finch/libfinch.c index d83dadc1f3..191a9eb9e4 100644 --- a/finch/libfinch.c +++ b/finch/libfinch.c @@ -26,6 +26,9 @@ #include <glib/gi18n-lib.h> #include <glib/gstdio.h> +#define G_SETTINGS_ENABLE_BACKEND +#include <gio/gsettingsbackend.h> + #include <locale.h> #include <purple.h> @@ -45,10 +48,24 @@ finch_quit(void) finch_ui_uninit(); } +static gpointer +finch_get_settings_backend(void) { + GSettingsBackend *backend = NULL; + char *config = NULL; + + config = g_build_filename(purple_config_dir(), "finch3.ini", NULL); + backend = g_keyfile_settings_backend_new(config, "/", NULL); + + g_free(config); + + return backend; +} + static PurpleCoreUiOps core_ops = { .ui_prefs_init = finch_prefs_init, .ui_init = finch_ui_init, .quit = finch_quit, + .get_settings_backend = finch_get_settings_backend, }; static PurpleCoreUiOps * |