# HG changeset patch
# Node ID 40c41e5f3b0a
# Parent  36c3c3cd2402
diff --git a/finch/libfinch.c b/finch/libfinch.c
--- 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_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 *
diff --git a/libpurple/core.c b/libpurple/core.c
--- a/libpurple/core.c
+++ b/libpurple/core.c
@@ -96,8 +96,6 @@
 purple_core_init(PurpleUiInfo *ui_info) {
 	PurpleCoreUiOps *ops;
 	PurpleCore *core;
-	gchar *config_file = NULL;
-	gchar *config = NULL;
 
 	g_return_val_if_fail(PURPLE_IS_UI_INFO(ui_info), FALSE);
 	g_return_val_if_fail(purple_get_core() == NULL, FALSE);
@@ -136,11 +134,7 @@
 	/* The prefs subsystem needs to be initialized before static protocols
 	 * for protocol prefs to work. */
 	purple_prefs_init();
-	config_file = g_strdup_printf("%s.ini", purple_ui_info_get_id(ui_info));
-	config = g_build_filename(purple_config_dir(), config_file, NULL);
-	settings_backend = g_keyfile_settings_backend_new(config, "/", NULL);
-	g_free(config_file);
-	g_free(config);
+	settings_backend = ops->get_settings_backend();
 
 	purple_debug_init();
 
diff --git a/libpurple/purplecoreuiops.h b/libpurple/purplecoreuiops.h
--- a/libpurple/purplecoreuiops.h
+++ b/libpurple/purplecoreuiops.h
@@ -42,17 +42,22 @@
  *                 should use this hook to set all other necessary
  *                 <link linkend="chapter-ui-ops"><literal>UiOps structures</literal></link>.
  * @quit:          Called after most of libpurple has been uninitialized.
+ * @get_settings_backend: Called to get the [class@Gio.SettingsBackend] that
+ *                        the UI is using.
  *
  * Callbacks that fire at different points of the initialization and teardown
  * of libpurple, along with a hook to return descriptive information about the
  * UI.
  */
 struct _PurpleCoreUiOps {
+	/*< public >*/
 	void (*ui_prefs_init)(void);
 	void (*ui_init)(void);
 
 	void (*quit)(void);
 
+	gpointer (*get_settings_backend)(void);
+
 	/*< private >*/
 	gpointer reserved[4];
 };
diff --git a/libpurple/tests/test_ui.c b/libpurple/tests/test_ui.c
--- a/libpurple/tests/test_ui.c
+++ b/libpurple/tests/test_ui.c
@@ -26,6 +26,9 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 
+#define G_SETTINGS_ENABLE_BACKEND
+#include <gio/gsettingsbackend.h>
+
 #include <signal.h>
 #include <string.h>
 #ifdef _WIN32
@@ -61,8 +64,14 @@
 	purple_conversations_set_ui_ops(&test_conv_uiops);
 }
 
+static gpointer
+test_ui_get_settings_backend(void) {
+	return g_memory_settings_backend_new();
+}
+
 static PurpleCoreUiOps test_core_uiops = {
-	.ui_init = test_ui_init
+	.ui_init = test_ui_init,
+	.get_settings_backend = test_ui_get_settings_backend,
 };
 
 static gboolean
diff --git a/pidgin/libpidgin.c b/pidgin/libpidgin.c
--- a/pidgin/libpidgin.c
+++ b/pidgin/libpidgin.c
@@ -30,6 +30,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>
@@ -300,10 +303,24 @@
 	g_application_quit(g_application_get_default());
 }
 
+static gpointer
+pidgin_get_settings_backend(void) {
+	GSettingsBackend *backend = NULL;
+	char *config = NULL;
+
+	config = g_build_filename(purple_config_dir(), "pidgin3.ini", NULL);
+	backend = g_keyfile_settings_backend_new(config, "/", NULL);
+
+	g_free(config);
+
+	return backend;
+}
+
 static PurpleCoreUiOps core_ops = {
 	.ui_prefs_init = pidgin_prefs_init,
 	.ui_init = pidgin_ui_init,
 	.quit = pidgin_quit,
+	.get_settings_backend = pidgin_get_settings_backend,
 };
 
 PurpleCoreUiOps *
