Cleanup - minimal glib=2.56.1 - drop all conditionals on older versions

This commit is contained in:
Geert Janssens 2021-09-10 16:57:25 +02:00
parent a20f2defc2
commit 6674b1bb6b
4 changed files with 1 additions and 39 deletions

View File

@ -762,10 +762,6 @@ set(PLATFORM_OSX 1)
set(HAVE_OSX_KEYCHAIN 1)
endif()
if(GLIB2_VERSION VERSION_GREATER_EQUAL 2.46.0)
set(HAVE_GLIB_2_46 1)
endif()
if(DISABLE_DEPRECATED_GNOME)
set(GNOME_DISABLE_DEPRECATED 1)
endif()

View File

@ -108,9 +108,6 @@
/* Define to 1 if you have the `getuid' function. */
#cmakedefine HAVE_GETUID 1
/* Configure g_settings_list_keys deprecation */
#cmakedefine HAVE_GLIB_2_46 1
/* Define to 1 if you have the <glob.h> header file. */
#cmakedefine HAVE_GLOB_H 1

View File

@ -52,9 +52,6 @@ teardown (Fixture *fixture, gconstpointer pData)
test_clear_error_list();
}
/* The excluded tests all rely on g_assert_true which was only introduced
* in glib 2.38 */
#ifdef HAVE_GLIB_2_38
static void
test_pending_matches_match_types (Fixture *fixture, gconstpointer pData)
{
@ -117,7 +114,6 @@ test_pending_matches_keeps_count (Fixture *fixture, gconstpointer pData)
gnc_import_PendingMatches_delete (matches);
}
#endif
int
main (int argc, char *argv[])
@ -126,16 +122,12 @@ main (int argc, char *argv[])
qof_init();
g_test_init (&argc, &argv, NULL);
/* The excluded tests all rely on g_assert_true which was only introduced
* in glib 2.38 */
#ifdef HAVE_GLIB_2_38
GNC_TEST_ADD (suitename, "match_types", Fixture, NULL, setup,
test_pending_matches_match_types, teardown);
GNC_TEST_ADD (suitename, "prefer_manual_match", Fixture, NULL, setup,
test_pending_matches_prefer_manual_match, teardown);
GNC_TEST_ADD (suitename, "keeps_count", Fixture, NULL, setup,
test_pending_matches_keeps_count, teardown);
#endif
result = g_test_run();
qof_close();

View File

@ -62,28 +62,17 @@ static gboolean gnc_gsettings_is_valid_key(GSettings *settings, const gchar *key
gchar **keys = NULL;
gint i = 0;
gboolean found = FALSE;
#ifdef HAVE_GLIB_2_46
GSettingsSchema *schema;
#endif
// Check if the key is valid key within settings
if (!G_IS_SETTINGS(settings))
return FALSE;
#ifdef HAVE_GLIB_2_46
g_object_get (settings, "settings-schema", &schema, NULL);
if (!schema)
return FALSE;
#endif
// Get list of keys
#ifdef HAVE_GLIB_2_46
keys = g_settings_schema_list_keys(schema);
#else
keys = g_settings_list_keys(settings);
#endif
keys = g_settings_schema_list_keys (schema);
while (keys && keys[i])
{
if (!g_strcmp0(key, keys[i]))
@ -93,8 +82,6 @@ static gboolean gnc_gsettings_is_valid_key(GSettings *settings, const gchar *key
}
i++;
}
// Free keys
g_strfreev(keys);
return found;
@ -588,27 +575,17 @@ gnc_gsettings_reset_schema (const gchar *schema_str)
{
gchar **keys;
gint counter = 0;
#ifdef HAVE_GLIB_2_46
GSettingsSchema *schema;
#endif
GSettings *settings = gnc_gsettings_get_settings_ptr (schema_str);
if (!settings)
return;
#ifdef HAVE_GLIB_2_46
g_object_get (settings, "settings-schema", &schema, NULL);
if (!schema)
return;
keys = g_settings_schema_list_keys (schema);
#else
keys = g_settings_list_keys (settings);
#endif
if (!keys)
return;