evolution-data-server: Actually drop tentative settings constructor

Since makeHardcodeGsettingsPatch now supports applying patches, let's
make use of it. Dropping e_reminder_watcher_load_settings_tentative
entirely brings us benefits that the build will fail loudly when new
calls appear.

We apply hardcode-gsettings.patch at the very end so all the patches
should apply fine.
This commit is contained in:
Bobby Rong 2023-11-15 23:11:42 +08:00 committed by Jan Tojnar
parent 549c51d541
commit dd011a2e79
3 changed files with 50 additions and 13 deletions

View file

@ -1,6 +1,6 @@
{ stdenv
, lib
, fetchzip
, fetchurl
, substituteAll
, pkg-config
, gnome
@ -55,16 +55,9 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ];
src = fetchzip {
src = fetchurl {
url = "mirror://gnome/sources/evolution-data-server/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "7TXEArGpnOxfQGnMtacYwHjCyH15RAjJW09lvVo1uDI=";
postFetch = ''
# Very dirty hack to make update script happy.
substituteInPlace $out/src/calendar/libecal/e-reminder-watcher.c \
--replace "settings = g_settings_new (schema_id)" "settings = NULL" \
--replace 'e_reminder_watcher_load_settings_tentative ("' 'g_settings_new ("'
'';
sha256 = "kfT/w4objS/ok5g0RJrFQcC/9KObRE7cKpUpNEoo6Yo=";
};
patches = [
@ -72,6 +65,10 @@ stdenv.mkDerivation rec {
src = ./fix-paths.patch;
inherit tzdata;
})
# Avoid using wrapper function, which the hardcode gsettings
# patch generator cannot handle.
./drop-tentative-settings-constructor.patch
];
prePatch = ''
@ -169,7 +166,7 @@ stdenv.mkDerivation rec {
"org.gnome.evolution-data-server" = "EDS";
"org.gnome.desktop.interface" = "GDS";
};
inherit src;
inherit src patches;
};
updateScript =
let

View file

@ -0,0 +1,40 @@
diff --git a/src/calendar/libecal/e-reminder-watcher.c b/src/calendar/libecal/e-reminder-watcher.c
index f1614f2..c01e8b2 100644
--- a/src/calendar/libecal/e-reminder-watcher.c
+++ b/src/calendar/libecal/e-reminder-watcher.c
@@ -2609,26 +2609,6 @@ e_reminder_watcher_load_clock_format (EReminderWatcher *watcher)
g_free (clock_format);
}
-static GSettings*
-e_reminder_watcher_load_settings_tentative (const gchar *schema_id)
-{
- GSettings *settings;
- GSettingsSchemaSource *schema_source;
- GSettingsSchema *schema;
-
- schema_source = g_settings_schema_source_get_default ();
- schema = g_settings_schema_source_lookup (schema_source, schema_id, TRUE);
-
- if (schema == NULL) {
- return NULL;
- }
-
- settings = g_settings_new (schema_id);
- /* only unref after g_settings_new() to avoid needless realloc */
- g_settings_schema_unref (schema);
- return settings;
-}
-
static void
e_reminder_watcher_init (EReminderWatcher *watcher)
{
@@ -2647,7 +2627,7 @@ e_reminder_watcher_init (EReminderWatcher *watcher)
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");
- watcher->priv->desktop_settings = e_reminder_watcher_load_settings_tentative ("org.gnome.desktop.interface");
+ watcher->priv->desktop_settings = g_settings_new ("org.gnome.desktop.interface");
if (watcher->priv->desktop_settings) {
g_signal_connect_object (
watcher->priv->desktop_settings,

View file

@ -202,10 +202,10 @@ index 2525856..7ecc1a8 100644
g_clear_object (&settings);
}
diff --git a/src/calendar/libecal/e-reminder-watcher.c b/src/calendar/libecal/e-reminder-watcher.c
index 2dbdd99..a6cf45c 100644
index c01e8b2..59fb4c4 100644
--- a/src/calendar/libecal/e-reminder-watcher.c
+++ b/src/calendar/libecal/e-reminder-watcher.c
@@ -2646,8 +2646,33 @@ e_reminder_watcher_init (EReminderWatcher *watcher)
@@ -2626,8 +2626,33 @@ e_reminder_watcher_init (EReminderWatcher *watcher)
watcher->priv = e_reminder_watcher_get_instance_private (watcher);
watcher->priv->cancellable = g_cancellable_new ();