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) set(HAVE_OSX_KEYCHAIN 1)
endif() endif()
if(GLIB2_VERSION VERSION_GREATER_EQUAL 2.46.0)
set(HAVE_GLIB_2_46 1)
endif()
if(DISABLE_DEPRECATED_GNOME) if(DISABLE_DEPRECATED_GNOME)
set(GNOME_DISABLE_DEPRECATED 1) set(GNOME_DISABLE_DEPRECATED 1)
endif() endif()

View File

@ -108,9 +108,6 @@
/* Define to 1 if you have the `getuid' function. */ /* Define to 1 if you have the `getuid' function. */
#cmakedefine HAVE_GETUID 1 #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. */ /* Define to 1 if you have the <glob.h> header file. */
#cmakedefine HAVE_GLOB_H 1 #cmakedefine HAVE_GLOB_H 1

View File

@ -52,9 +52,6 @@ teardown (Fixture *fixture, gconstpointer pData)
test_clear_error_list(); 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 static void
test_pending_matches_match_types (Fixture *fixture, gconstpointer pData) 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); gnc_import_PendingMatches_delete (matches);
} }
#endif
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
@ -126,16 +122,12 @@ main (int argc, char *argv[])
qof_init(); qof_init();
g_test_init (&argc, &argv, NULL); 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, GNC_TEST_ADD (suitename, "match_types", Fixture, NULL, setup,
test_pending_matches_match_types, teardown); test_pending_matches_match_types, teardown);
GNC_TEST_ADD (suitename, "prefer_manual_match", Fixture, NULL, setup, GNC_TEST_ADD (suitename, "prefer_manual_match", Fixture, NULL, setup,
test_pending_matches_prefer_manual_match, teardown); test_pending_matches_prefer_manual_match, teardown);
GNC_TEST_ADD (suitename, "keeps_count", Fixture, NULL, setup, GNC_TEST_ADD (suitename, "keeps_count", Fixture, NULL, setup,
test_pending_matches_keeps_count, teardown); test_pending_matches_keeps_count, teardown);
#endif
result = g_test_run(); result = g_test_run();
qof_close(); qof_close();

View File

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