diff options
author | zhuyaliang <[email protected]> | 2023-09-04 10:22:43 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-09-04 09:50:33 +0200 |
commit | 3337cb990ddebb7760a3aa0804049a7cfeb7581a (patch) | |
tree | 47e63733e82f245e6a0ce225773c85372de07bc6 | |
parent | aeebf91224e292fcfa3b99229537d4619009705a (diff) | |
download | mate-session-manager-3337cb990ddebb7760a3aa0804049a7cfeb7581a.tar.bz2 mate-session-manager-3337cb990ddebb7760a3aa0804049a7cfeb7581a.tar.xz |
Revert "gsm-manager: use g_settings_schema_source_lookup ()"
This reverts commit 92c9a82105b222a934e994a87738673351ad33ee.
Fix https://github.com/mate-desktop/mate-session-manager/issues/308
-rw-r--r-- | mate-session/gsm-manager.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c index 0ca852f..37ca39d 100644 --- a/mate-session/gsm-manager.c +++ b/mate-session/gsm-manager.c @@ -2838,7 +2838,9 @@ on_presence_status_changed (GsmPresence *presence, static void gsm_manager_init (GsmManager *manager) { - GSettingsSchema *schema; + gchar **schemas = NULL; + gboolean schema_exists; + guint i; GsmManagerPrivate *priv; priv = gsm_manager_get_instance_private (manager); @@ -2847,15 +2849,21 @@ gsm_manager_init (GsmManager *manager) priv->settings_lockdown = g_settings_new (LOCKDOWN_SCHEMA); /* check if mate-screensaver is installed */ - schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), - SCREENSAVER_SCHEMA, FALSE); + g_settings_schema_source_list_schemas (g_settings_schema_source_get_default (), TRUE, &schemas, NULL); + schema_exists = FALSE; + for (i = 0; schemas[i] != NULL; i++) { + if (g_str_equal (schemas[i], SCREENSAVER_SCHEMA)) { + schema_exists = TRUE; + break; + } + } - if (schema != NULL) { - priv->settings_screensaver = g_settings_new_full (schema, NULL, NULL); - g_settings_schema_unref (schema); - } else { + g_strfreev (schemas); + + if (schema_exists == TRUE) + priv->settings_screensaver = g_settings_new (SCREENSAVER_SCHEMA); + else priv->settings_screensaver = NULL; - } priv->inhibitors = gsm_store_new (); g_signal_connect (priv->inhibitors, |