summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-11-23 21:47:29 +0100
committerrbuj <[email protected]>2021-11-23 21:58:17 +0100
commitc76a9911a692a568ba1d735e8aff39a0cb9a784d (patch)
tree84cd3f8ce7deff8c85c994914391716f42e7c481
parent34aafe51a3b610a1f3b957b92141f49574e833d5 (diff)
downloadmate-session-manager-g_settings_schema_source_lookup.tar.bz2
mate-session-manager-g_settings_schema_source_lookup.tar.xz
gsm-manager: use g_settings_schema_source_lookup ()g_settings_schema_source_lookup
-rw-r--r--mate-session/gsm-manager.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/mate-session/gsm-manager.c b/mate-session/gsm-manager.c
index 9b5374e..54a48f4 100644
--- a/mate-session/gsm-manager.c
+++ b/mate-session/gsm-manager.c
@@ -2838,9 +2838,7 @@ on_presence_status_changed (GsmPresence *presence,
static void
gsm_manager_init (GsmManager *manager)
{
- gchar **schemas = NULL;
- gboolean schema_exists;
- guint i;
+ GSettingsSchema *schema;
GsmManagerPrivate *priv;
priv = gsm_manager_get_instance_private (manager);
@@ -2849,21 +2847,15 @@ gsm_manager_init (GsmManager *manager)
priv->settings_lockdown = g_settings_new (LOCKDOWN_SCHEMA);
/* check if mate-screensaver is installed */
- 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;
- }
- }
-
- g_strfreev (schemas);
+ schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
+ SCREENSAVER_SCHEMA, FALSE);
- if (schema_exists == TRUE)
- priv->settings_screensaver = g_settings_new (SCREENSAVER_SCHEMA);
- else
+ if (schema != NULL) {
+ priv->settings_screensaver = g_settings_new_full (schema, NULL, NULL);
+ g_settings_schema_unref (schema);
+ } else {
priv->settings_screensaver = NULL;
+ }
priv->inhibitors = gsm_store_new ();
g_signal_connect (priv->inhibitors,