about summary refs log tree commit diff
path: root/pkgs/desktops/gnome/core/evolution-data-server
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-07-23 15:44:31 +0000
committerJan Tojnar <jtojnar@gmail.com>2022-09-07 14:23:28 +0200
commit6262fa0b1724a32ffe07cf69e3b7284c8ea17ed2 (patch)
treee7e1fc18dd2cae16997f47267e6f424eff63d811 /pkgs/desktops/gnome/core/evolution-data-server
parent9137e671a2e2f5b46748ae21b21737b3f4194883 (diff)
evolution-data-server: generate GSettings patch as part of update script
This should avoid it getting out of sync again.
Diffstat (limited to 'pkgs/desktops/gnome/core/evolution-data-server')
-rw-r--r--pkgs/desktops/gnome/core/evolution-data-server/default.nix45
-rw-r--r--pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.cocci76
-rw-r--r--pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.patch315
3 files changed, 289 insertions, 147 deletions
diff --git a/pkgs/desktops/gnome/core/evolution-data-server/default.nix b/pkgs/desktops/gnome/core/evolution-data-server/default.nix
index f7c2fcee549e5..ea4616a233069 100644
--- a/pkgs/desktops/gnome/core/evolution-data-server/default.nix
+++ b/pkgs/desktops/gnome/core/evolution-data-server/default.nix
@@ -2,8 +2,12 @@
 , lib
 , fetchurl
 , substituteAll
+, runCommand
+, git
+, coccinelle
 , pkg-config
 , gnome
+, update-script-combinators
 , python3
 , gobject-introspection
 , gettext
@@ -63,7 +67,7 @@ stdenv.mkDerivation rec {
 
   prePatch = ''
     substitute ${./hardcode-gsettings.patch} hardcode-gsettings.patch \
-      --subst-var-by ESD_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"} \
+      --subst-var-by EDS_GSETTINGS_PATH ${glib.makeSchemaPath "$out" "${pname}-${version}"} \
       --subst-var-by GDS_GSETTINGS_PATH ${glib.getSchemaPath gsettings-desktop-schemas}
     patches="$patches $PWD/hardcode-gsettings.patch"
   '';
@@ -125,10 +129,41 @@ stdenv.mkDerivation rec {
   ];
 
   passthru = {
-    updateScript = gnome.updateScript {
-      packageName = "evolution-data-server";
-      versionPolicy = "odd-unstable";
-    };
+    # In order for GNOME not to depend on OCaml through Coccinelle,
+    # we materialize the SmPL patch into a unified diff-style patch.
+    hardcodeGsettingsPatch =
+      runCommand
+        "hardcode-gsettings.patch"
+        {
+          inherit src;
+          nativeBuildInputs = [
+            git
+            coccinelle
+            python3 # For patch script
+          ];
+        }
+        ''
+          unpackPhase
+          cd "''${sourceRoot:-.}"
+          git init
+          git add -A
+          spatch --sp-file "${./hardcode-gsettings.cocci}" --dir . --in-place
+          git diff > "$out"
+        '';
+
+    updateScript =
+      let
+        updateSource = gnome.updateScript {
+          packageName = "evolution-data-server";
+          versionPolicy = "odd-unstable";
+        };
+
+        updateGsettingsPatch = update-script-combinators.copyAttrOutputToFile "evolution-data-server.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
+      in
+      update-script-combinators.sequence [
+        updateSource
+        updateGsettingsPatch
+      ];
   };
 
   meta = with lib; {
diff --git a/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.cocci b/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.cocci
new file mode 100644
index 0000000000000..9e60e892b7116
--- /dev/null
+++ b/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.cocci
@@ -0,0 +1,76 @@
+/**
+ * Since Nix does not have a standard location like /usr/share,
+ * where GSettings system could look for schemas, we need to point the software to a correct location somehow.
+ * For executables, we handle this using wrappers but this is not an option for libraries like e-d-s.
+ * Instead, we hardcode the schema path when creating the settings.
+ */
+
+@initialize:python@
+@@
+
+cpp_constants = {}
+
+def register_cpp_constant(const_name, val):
+    cpp_constants[const_name] = val.strip()
+
+def resolve_cpp_constant(const_name):
+    return cpp_constants.get(const_name, const_name)
+
+e_s_d_schema_constants = [
+    # The following are actually part of e-d-s, despite the name.
+    # We rename the old ambiguos constant name in ./prepare-for-gsettings-patching.patch
+    "\"org.gnome.Evolution.DefaultSources\"",
+    "\"org.gnome.evolution.shell.network-config\"",
+]
+
+g_d_s_schema_constants = [
+    "\"org.gnome.system.proxy\"",
+]
+
+def get_schema_directory(schema_path):
+    # Sometimes the schema id is referenced using C preprocessor #define constant in the same file
+    # let’s try to resolve it first.
+    schema_path = resolve_cpp_constant(schema_path.strip())
+    if schema_path.startswith("\"org.gnome.evolution-data-server") or schema_path in e_s_d_schema_constants:
+        return "\"@EDS_GSETTINGS_PATH@\""
+    elif schema_path in g_d_s_schema_constants:
+        return "\"@GDS_GSETTINGS_PATH@\""
+    raise Exception(f"Unknown schema path {schema_path}")
+
+
+@find_cpp_constants@
+identifier const_name;
+expression val;
+@@
+
+#define const_name val
+
+@script:python record_cpp_constants depends on find_cpp_constants@
+const_name << find_cpp_constants.const_name;
+val << find_cpp_constants.val;
+@@
+
+register_cpp_constant(const_name, val)
+
+
+@depends on ever record_cpp_constants || never record_cpp_constants@
+// We want to run after #define constants have been collected but even if there are no #defines.
+expression SCHEMA_PATH;
+expression settings;
+// Coccinelle does not like autocleanup macros in + sections,
+// let’s use fresh id with concatenation to produce the code as a string.
+fresh identifier schema_source_decl = "g_autoptr(GSettingsSchemaSource) " ## "schema_source";
+fresh identifier schema_decl = "g_autoptr(GSettingsSchema) " ## "schema";
+fresh identifier SCHEMA_DIRECTORY = script:python(SCHEMA_PATH) { get_schema_directory(SCHEMA_PATH) };
+@@
+-settings = g_settings_new(SCHEMA_PATH);
++{
++	schema_source_decl;
++	schema_decl;
++	schema_source = g_settings_schema_source_new_from_directory(SCHEMA_DIRECTORY,
++	                                                            g_settings_schema_source_get_default(),
++	                                                            TRUE,
++	                                                            NULL);
++	schema = g_settings_schema_source_lookup(schema_source, SCHEMA_PATH, FALSE);
++	settings = g_settings_new_full(schema, NULL, NULL);
++}
diff --git a/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.patch b/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.patch
index 4e345c3cb3ca8..c756b4bcc2ac2 100644
--- a/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.patch
+++ b/pkgs/desktops/gnome/core/evolution-data-server/hardcode-gsettings.patch
@@ -1,16 +1,16 @@
 diff --git a/src/addressbook/libebook/e-book-client.c b/src/addressbook/libebook/e-book-client.c
-index 2c0557c3c..5955aa55e 100644
+index 7888e69..c3b695c 100644
 --- a/src/addressbook/libebook/e-book-client.c
 +++ b/src/addressbook/libebook/e-book-client.c
-@@ -1989,7 +1989,20 @@ e_book_client_get_self (ESourceRegistry *registry,
+@@ -1983,7 +1983,18 @@ e_book_client_get_self (ESourceRegistry *registry,
  
  	*out_client = book_client;
  
 -	settings = g_settings_new (SELF_UID_PATH_ID);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -18,21 +18,19 @@ index 2c0557c3c..5955aa55e 100644
 +							 SELF_UID_PATH_ID,
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	uid = g_settings_get_string (settings, SELF_UID_KEY);
  	g_object_unref (settings);
  
-@@ -2057,7 +2070,20 @@ e_book_client_set_self (EBookClient *client,
+@@ -2051,7 +2062,18 @@ e_book_client_set_self (EBookClient *client,
  	g_return_val_if_fail (
  		e_contact_get_const (contact, E_CONTACT_UID) != NULL, FALSE);
  
 -	settings = g_settings_new (SELF_UID_PATH_ID);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -40,22 +38,20 @@ index 2c0557c3c..5955aa55e 100644
 +							 SELF_UID_PATH_ID,
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	g_settings_set_string (
  		settings, SELF_UID_KEY,
  		e_contact_get_const (contact, E_CONTACT_UID));
-@@ -2093,8 +2119,20 @@ e_book_client_is_self (EContact *contact)
+@@ -2087,8 +2109,18 @@ e_book_client_is_self (EContact *contact)
  	 * unfortunately the API doesn't allow that.
  	 */
  	g_mutex_lock (&mutex);
 -	if (!settings)
 -		settings = g_settings_new (SELF_UID_PATH_ID);
 +	if (!settings) {
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -63,25 +59,23 @@ index 2c0557c3c..5955aa55e 100644
 +							 SELF_UID_PATH_ID,
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	uid = g_settings_get_string (settings, SELF_UID_KEY);
  	g_mutex_unlock (&mutex);
  
 diff --git a/src/addressbook/libebook/e-book.c b/src/addressbook/libebook/e-book.c
-index 3396b57c0..ac6420b2e 100644
+index 8dfff6d..cd88392 100644
 --- a/src/addressbook/libebook/e-book.c
 +++ b/src/addressbook/libebook/e-book.c
-@@ -2594,7 +2594,20 @@ e_book_get_self (ESourceRegistry *registry,
+@@ -2587,7 +2587,18 @@ e_book_get_self (ESourceRegistry *registry,
  		return FALSE;
  	}
  
 -	settings = g_settings_new (SELF_UID_PATH_ID);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -89,21 +83,19 @@ index 3396b57c0..ac6420b2e 100644
 +							 SELF_UID_PATH_ID,
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	uid = g_settings_get_string (settings, SELF_UID_KEY);
  	g_object_unref (settings);
  
-@@ -2649,7 +2662,20 @@ e_book_set_self (EBook *book,
+@@ -2642,7 +2653,18 @@ e_book_set_self (EBook *book,
  	g_return_val_if_fail (E_IS_BOOK (book), FALSE);
  	g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
  
 -	settings = g_settings_new (SELF_UID_PATH_ID);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -111,21 +103,19 @@ index 3396b57c0..ac6420b2e 100644
 +							 SELF_UID_PATH_ID,
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	g_settings_set_string (
  		settings, SELF_UID_KEY,
  		e_contact_get_const (contact, E_CONTACT_UID));
-@@ -2677,7 +2703,20 @@ e_book_is_self (EContact *contact)
+@@ -2670,7 +2692,18 @@ e_book_is_self (EContact *contact)
  
  	g_return_val_if_fail (E_IS_CONTACT (contact), FALSE);
  
 -	settings = g_settings_new (SELF_UID_PATH_ID);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -133,25 +123,23 @@ index 3396b57c0..ac6420b2e 100644
 +							 SELF_UID_PATH_ID,
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	uid = g_settings_get_string (settings, SELF_UID_KEY);
  	g_object_unref (settings);
  
 diff --git a/src/calendar/backends/contacts/e-cal-backend-contacts.c b/src/calendar/backends/contacts/e-cal-backend-contacts.c
-index de1716941..e83b104f1 100644
+index e696861..52af238 100644
 --- a/src/calendar/backends/contacts/e-cal-backend-contacts.c
 +++ b/src/calendar/backends/contacts/e-cal-backend-contacts.c
-@@ -1397,7 +1397,20 @@ e_cal_backend_contacts_init (ECalBackendContacts *cbc)
+@@ -1387,7 +1387,18 @@ e_cal_backend_contacts_init (ECalBackendContacts *cbc)
  		(GDestroyNotify) g_free,
  		(GDestroyNotify) contact_record_free);
  
 -	cbc->priv->settings = g_settings_new ("org.gnome.evolution-data-server.calendar");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -159,25 +147,23 @@ index de1716941..e83b104f1 100644
 +							 "org.gnome.evolution-data-server.calendar",
 +							 FALSE);
 +		cbc->priv->settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	cbc->priv->notifyid = 0;
  	cbc->priv->update_alarms_id = 0;
  	cbc->priv->alarm_enabled = FALSE;
 diff --git a/src/calendar/libecal/e-reminder-watcher.c b/src/calendar/libecal/e-reminder-watcher.c
-index b08a7f301..a49fe39c5 100644
+index a24ede2..5d2a032 100644
 --- a/src/calendar/libecal/e-reminder-watcher.c
 +++ b/src/calendar/libecal/e-reminder-watcher.c
-@@ -2202,7 +2202,21 @@ e_reminder_watcher_init (EReminderWatcher *watcher)
+@@ -2477,7 +2477,19 @@ e_reminder_watcher_init (EReminderWatcher *watcher)
  
- 	watcher->priv = G_TYPE_INSTANCE_GET_PRIVATE (watcher, E_TYPE_REMINDER_WATCHER, EReminderWatcherPrivate);
+ 	watcher->priv = e_reminder_watcher_get_instance_private (watcher);
  	watcher->priv->cancellable = g_cancellable_new ();
 -	watcher->priv->settings = g_settings_new ("org.gnome.evolution-data-server.calendar");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -186,25 +172,23 @@ index b08a7f301..a49fe39c5 100644
 +							 FALSE);
 +		watcher->priv->settings = g_settings_new_full(schema, NULL,
 +							      NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	watcher->priv->scheduled = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, e_reminder_watcher_free_rd_slist);
- 	watcher->priv->default_zone = icaltimezone_copy (zone);
+ 	watcher->priv->default_zone = e_cal_util_copy_timezone (zone);
  	watcher->priv->timers_enabled = TRUE;
 diff --git a/src/camel/camel-cipher-context.c b/src/camel/camel-cipher-context.c
-index dcdc3eed0..fd2e428c2 100644
+index 8013ba7..ba74769 100644
 --- a/src/camel/camel-cipher-context.c
 +++ b/src/camel/camel-cipher-context.c
-@@ -1635,7 +1635,20 @@ camel_cipher_can_load_photos (void)
+@@ -1625,7 +1625,18 @@ camel_cipher_can_load_photos (void)
  	GSettings *settings;
  	gboolean load_photos;
  
 -	settings = g_settings_new ("org.gnome.evolution-data-server");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -212,25 +196,23 @@ index dcdc3eed0..fd2e428c2 100644
 +							 "org.gnome.evolution-data-server",
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	load_photos = g_settings_get_boolean (settings, "camel-cipher-load-photos");
  	g_clear_object (&settings);
  
 diff --git a/src/camel/camel-gpg-context.c b/src/camel/camel-gpg-context.c
-index 1b3362886..f0811b292 100644
+index 685d3ab..521d91f 100644
 --- a/src/camel/camel-gpg-context.c
 +++ b/src/camel/camel-gpg-context.c
-@@ -573,7 +573,20 @@ gpg_ctx_get_executable_name (void)
+@@ -571,7 +571,18 @@ gpg_ctx_get_executable_name (void)
  		GSettings *settings;
  		gchar *path;
  
 -		settings = g_settings_new ("org.gnome.evolution-data-server");
 +		{
-+			GSettingsSchemaSource *schema_source;
-+			GSettingsSchema *schema;
-+			schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++			g_autoptr(GSettingsSchemaSource) schema_source;
++			g_autoptr(GSettingsSchema) schema;
++			schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +										    g_settings_schema_source_get_default(),
 +										    TRUE,
 +										    NULL);
@@ -238,25 +220,72 @@ index 1b3362886..f0811b292 100644
 +								 "org.gnome.evolution-data-server",
 +								 FALSE);
 +			settings = g_settings_new_full(schema, NULL, NULL);
-+			g_settings_schema_source_unref(schema_source);
-+			g_settings_schema_unref(schema);
 +		}
  		path = g_settings_get_string (settings, "camel-gpg-binary");
  		g_clear_object (&settings);
  
+diff --git a/src/camel/camel-utils.c b/src/camel/camel-utils.c
+index e61160c..d17871a 100644
+--- a/src/camel/camel-utils.c
++++ b/src/camel/camel-utils.c
+@@ -362,7 +362,19 @@ void
+ _camel_utils_initialize (void)
+ {
+ 	G_LOCK (mi_user_headers);
+-	mi_user_headers_settings = g_settings_new ("org.gnome.evolution-data-server");
++	{
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
++									    g_settings_schema_source_get_default(),
++									    TRUE,
++									    NULL);
++		schema = g_settings_schema_source_lookup(schema_source,
++							 "org.gnome.evolution-data-server",
++							 FALSE);
++		mi_user_headers_settings = g_settings_new_full(schema, NULL,
++							       NULL);
++	}
+ 	g_signal_connect (mi_user_headers_settings, "changed::camel-message-info-user-headers",
+ 		G_CALLBACK (mi_user_headers_settings_changed_cb), NULL);
+ 	G_UNLOCK (mi_user_headers);
+diff --git a/src/camel/providers/smtp/camel-smtp-transport.c b/src/camel/providers/smtp/camel-smtp-transport.c
+index f535ad6..30130b9 100644
+--- a/src/camel/providers/smtp/camel-smtp-transport.c
++++ b/src/camel/providers/smtp/camel-smtp-transport.c
+@@ -1458,7 +1458,18 @@ smtp_helo (CamelSmtpTransport *transport,
+ 		transport->authtypes = NULL;
+ 	}
+ 
+-	settings = g_settings_new ("org.gnome.evolution-data-server");
++	{
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
++									    g_settings_schema_source_get_default(),
++									    TRUE,
++									    NULL);
++		schema = g_settings_schema_source_lookup(schema_source,
++							 "org.gnome.evolution-data-server",
++							 FALSE);
++		settings = g_settings_new_full(schema, NULL, NULL);
++	}
+ 	name = g_settings_get_string (settings, "camel-smtp-helo-argument");
+ 	g_clear_object (&settings);
+ 
 diff --git a/src/libedataserver/e-network-monitor.c b/src/libedataserver/e-network-monitor.c
-index e0d8b87d6..3a4d5a359 100644
+index 188f276..7c4db94 100644
 --- a/src/libedataserver/e-network-monitor.c
 +++ b/src/libedataserver/e-network-monitor.c
-@@ -255,7 +255,20 @@ e_network_monitor_constructed (GObject *object)
+@@ -256,7 +256,18 @@ e_network_monitor_constructed (GObject *object)
  	/* Chain up to parent's method. */
  	G_OBJECT_CLASS (e_network_monitor_parent_class)->constructed (object);
  
 -	settings = g_settings_new ("org.gnome.evolution-data-server");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -264,25 +293,23 @@ index e0d8b87d6..3a4d5a359 100644
 +							 "org.gnome.evolution-data-server",
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	g_settings_bind (
  		settings, "network-monitor-gio-name",
  		object, "gio-name",
 diff --git a/src/libedataserver/e-oauth2-service-google.c b/src/libedataserver/e-oauth2-service-google.c
-index f0c6f2cbf..0053e3ce6 100644
+index f9d9056..115d344 100644
 --- a/src/libedataserver/e-oauth2-service-google.c
 +++ b/src/libedataserver/e-oauth2-service-google.c
-@@ -69,7 +69,20 @@ eos_google_read_settings (EOAuth2Service *service,
+@@ -70,7 +70,18 @@ eos_google_read_settings (EOAuth2Service *service,
  	if (!value) {
  		GSettings *settings;
  
 -		settings = g_settings_new ("org.gnome.evolution-data-server");
 +		{
-+			GSettingsSchemaSource *schema_source;
-+			GSettingsSchema *schema;
-+			schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++			g_autoptr(GSettingsSchemaSource) schema_source;
++			g_autoptr(GSettingsSchema) schema;
++			schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +										    g_settings_schema_source_get_default(),
 +										    TRUE,
 +										    NULL);
@@ -290,25 +317,47 @@ index f0c6f2cbf..0053e3ce6 100644
 +								 "org.gnome.evolution-data-server",
 +								 FALSE);
 +			settings = g_settings_new_full(schema, NULL, NULL);
-+			g_settings_schema_source_unref(schema_source);
-+			g_settings_schema_unref(schema);
 +		}
  		value = g_settings_get_string (settings, key_name);
  		g_object_unref (settings);
  
 diff --git a/src/libedataserver/e-oauth2-service-outlook.c b/src/libedataserver/e-oauth2-service-outlook.c
-index 687c10d3b..684583c35 100644
+index 687c10d..ac1deae 100644
 --- a/src/libedataserver/e-oauth2-service-outlook.c
 +++ b/src/libedataserver/e-oauth2-service-outlook.c
-@@ -70,7 +70,20 @@ eos_outlook_read_settings (EOAuth2Service *service,
+@@ -70,7 +70,18 @@ eos_outlook_read_settings (EOAuth2Service *service,
+ 	if (!value) {
+ 		GSettings *settings;
+ 
+-		settings = g_settings_new ("org.gnome.evolution-data-server");
++		{
++			g_autoptr(GSettingsSchemaSource) schema_source;
++			g_autoptr(GSettingsSchema) schema;
++			schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
++										    g_settings_schema_source_get_default(),
++										    TRUE,
++										    NULL);
++			schema = g_settings_schema_source_lookup(schema_source,
++								 "org.gnome.evolution-data-server",
++								 FALSE);
++			settings = g_settings_new_full(schema, NULL, NULL);
++		}
+ 		value = g_settings_get_string (settings, key_name);
+ 		g_object_unref (settings);
+ 
+diff --git a/src/libedataserver/e-oauth2-service-yahoo.c b/src/libedataserver/e-oauth2-service-yahoo.c
+index 329a38c..f541393 100644
+--- a/src/libedataserver/e-oauth2-service-yahoo.c
++++ b/src/libedataserver/e-oauth2-service-yahoo.c
+@@ -66,7 +66,18 @@ eos_yahoo_read_settings (EOAuth2Service *service,
  	if (!value) {
  		GSettings *settings;
  
 -		settings = g_settings_new ("org.gnome.evolution-data-server");
 +		{
-+			GSettingsSchemaSource *schema_source;
-+			GSettingsSchema *schema;
-+			schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++			g_autoptr(GSettingsSchemaSource) schema_source;
++			g_autoptr(GSettingsSchema) schema;
++			schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +										    g_settings_schema_source_get_default(),
 +										    TRUE,
 +										    NULL);
@@ -316,25 +365,23 @@ index 687c10d3b..684583c35 100644
 +								 "org.gnome.evolution-data-server",
 +								 FALSE);
 +			settings = g_settings_new_full(schema, NULL, NULL);
-+			g_settings_schema_source_unref(schema_source);
-+			g_settings_schema_unref(schema);
 +		}
  		value = g_settings_get_string (settings, key_name);
  		g_object_unref (settings);
  
 diff --git a/src/libedataserver/e-oauth2-service.c b/src/libedataserver/e-oauth2-service.c
-index 682673c16..436f52d5f 100644
+index 979095b..ecac6bb 100644
 --- a/src/libedataserver/e-oauth2-service.c
 +++ b/src/libedataserver/e-oauth2-service.c
-@@ -95,7 +95,20 @@ eos_default_guess_can_process (EOAuth2Service *service,
+@@ -89,7 +89,18 @@ eos_default_guess_can_process (EOAuth2Service *service,
  	name_len = strlen (name);
  	hostname_len = strlen (hostname);
  
 -	settings = g_settings_new ("org.gnome.evolution-data-server");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -342,26 +389,24 @@ index 682673c16..436f52d5f 100644
 +							 "org.gnome.evolution-data-server",
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	values = g_settings_get_strv (settings, "oauth2-services-hint");
  	g_object_unref (settings);
  
 diff --git a/src/libedataserver/e-proxy.c b/src/libedataserver/e-proxy.c
-index 883379a60..989353494 100644
+index bcd07f9..17db26c 100644
 --- a/src/libedataserver/e-proxy.c
 +++ b/src/libedataserver/e-proxy.c
-@@ -969,8 +969,37 @@ e_proxy_init (EProxy *proxy)
+@@ -957,8 +957,33 @@ e_proxy_init (EProxy *proxy)
  
  	proxy->priv->type = PROXY_TYPE_SYSTEM;
  
 -	proxy->priv->evolution_proxy_settings = g_settings_new ("org.gnome.evolution.shell.network-config");
 -	proxy->priv->proxy_settings = g_settings_new ("org.gnome.system.proxy");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -371,12 +416,10 @@ index 883379a60..989353494 100644
 +		proxy->priv->evolution_proxy_settings = g_settings_new_full(schema,
 +									    NULL,
 +									    NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
 +		schema_source = g_settings_schema_source_new_from_directory("@GDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
@@ -386,25 +429,23 @@ index 883379a60..989353494 100644
 +							 FALSE);
 +		proxy->priv->proxy_settings = g_settings_new_full(schema,
 +								  NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	proxy->priv->proxy_http_settings = g_settings_get_child (proxy->priv->proxy_settings, "http");
  	proxy->priv->proxy_https_settings = g_settings_get_child (proxy->priv->proxy_settings, "https");
  	proxy->priv->proxy_socks_settings = g_settings_get_child (proxy->priv->proxy_settings, "socks");
 diff --git a/src/libedataserver/e-source-registry.c b/src/libedataserver/e-source-registry.c
-index a5a30a3e1..5fbdf8190 100644
+index 837e940..4bbd00d 100644
 --- a/src/libedataserver/e-source-registry.c
 +++ b/src/libedataserver/e-source-registry.c
-@@ -1749,7 +1749,21 @@ e_source_registry_init (ESourceRegistry *registry)
+@@ -1769,7 +1769,19 @@ e_source_registry_init (ESourceRegistry *registry)
  
  	g_mutex_init (&registry->priv->sources_lock);
  
 -	registry->priv->settings = g_settings_new (GSETTINGS_SCHEMA);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -413,25 +454,23 @@ index a5a30a3e1..5fbdf8190 100644
 +							 FALSE);
 +		registry->priv->settings = g_settings_new_full(schema, NULL,
 +							       NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  
  	g_signal_connect (
  		registry->priv->settings, "changed",
 diff --git a/src/libedataserverui/e-reminders-widget.c b/src/libedataserverui/e-reminders-widget.c
-index f89cd4a5c..06cca9b5f 100644
+index d18474d..418ccc2 100644
 --- a/src/libedataserverui/e-reminders-widget.c
 +++ b/src/libedataserverui/e-reminders-widget.c
-@@ -1650,7 +1650,21 @@ static void
+@@ -1874,7 +1874,19 @@ static void
  e_reminders_widget_init (ERemindersWidget *reminders)
  {
  	reminders->priv = e_reminders_widget_get_instance_private (reminders);
 -	reminders->priv->settings = g_settings_new ("org.gnome.evolution-data-server.calendar");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -440,25 +479,23 @@ index f89cd4a5c..06cca9b5f 100644
 +							 FALSE);
 +		reminders->priv->settings = g_settings_new_full(schema, NULL,
 +								NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  	reminders->priv->cancellable = g_cancellable_new ();
  	reminders->priv->is_empty = TRUE;
  	reminders->priv->is_mapped = FALSE;
 diff --git a/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c b/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
-index 6f03053d6..dffc186c7 100644
+index 6f03053..127c92e 100644
 --- a/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
 +++ b/src/services/evolution-source-registry/evolution-source-registry-autoconfig.c
-@@ -706,7 +706,20 @@ evolution_source_registry_merge_autoconfig_sources (ESourceRegistryServer *serve
+@@ -706,7 +706,18 @@ evolution_source_registry_merge_autoconfig_sources (ESourceRegistryServer *serve
  	gchar *autoconfig_directory;
  	gint ii;
  
 -	settings = g_settings_new ("org.gnome.evolution-data-server");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -466,25 +503,23 @@ index 6f03053d6..dffc186c7 100644
 +							 "org.gnome.evolution-data-server",
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  
  	autoconfig_sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, e_autoconfig_free_merge_source_data);
  
 diff --git a/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c b/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
-index d531cb9e2..c5b1c761c 100644
+index d531cb9..3d8807c 100644
 --- a/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
 +++ b/src/services/evolution-source-registry/evolution-source-registry-migrate-proxies.c
-@@ -61,7 +61,20 @@ evolution_source_registry_migrate_proxies (ESourceRegistryServer *server)
+@@ -61,7 +61,18 @@ evolution_source_registry_migrate_proxies (ESourceRegistryServer *server)
  	extension_name = E_SOURCE_EXTENSION_PROXY;
  	extension = e_source_get_extension (source, extension_name);
  
 -	settings = g_settings_new (NETWORK_CONFIG_SCHEMA_ID);
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -492,25 +527,23 @@ index d531cb9e2..c5b1c761c 100644
 +								 NETWORK_CONFIG_SCHEMA_ID,
 +								 FALSE);
 +			settings = g_settings_new_full(schema, NULL, NULL);
-+			g_settings_schema_source_unref(schema_source);
-+			g_settings_schema_unref(schema);
 +	}
  
  	switch (g_settings_get_int (settings, "proxy-type")) {
  		case 1:
 diff --git a/src/services/evolution-source-registry/evolution-source-registry.c b/src/services/evolution-source-registry/evolution-source-registry.c
-index 1c0a11382..3e144845e 100644
+index 1c0a113..d26b059 100644
 --- a/src/services/evolution-source-registry/evolution-source-registry.c
 +++ b/src/services/evolution-source-registry/evolution-source-registry.c
-@@ -181,7 +181,20 @@ main (gint argc,
+@@ -181,7 +181,18 @@ main (gint argc,
  
  reload:
  
 -	settings = g_settings_new ("org.gnome.evolution-data-server");
 +	{
-+		GSettingsSchemaSource *schema_source;
-+		GSettingsSchema *schema;
-+		schema_source = g_settings_schema_source_new_from_directory("@ESD_GSETTINGS_PATH@",
++		g_autoptr(GSettingsSchemaSource) schema_source;
++		g_autoptr(GSettingsSchema) schema;
++		schema_source = g_settings_schema_source_new_from_directory("@EDS_GSETTINGS_PATH@",
 +									    g_settings_schema_source_get_default(),
 +									    TRUE,
 +									    NULL);
@@ -518,8 +551,6 @@ index 1c0a11382..3e144845e 100644
 +							 "org.gnome.evolution-data-server",
 +							 FALSE);
 +		settings = g_settings_new_full(schema, NULL, NULL);
-+		g_settings_schema_source_unref(schema_source);
-+		g_settings_schema_unref(schema);
 +	}
  
  	if (!opt_disable_migration && !g_settings_get_boolean (settings, "migrated")) {