summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-05-04 15:13:26 +0200
committerStefano Karapetsas <[email protected]>2014-05-04 15:13:26 +0200
commitffb083eba37dbfb8407ac41f5a134d2e64f69cec (patch)
tree49c024a4994189b27241ff55284fd1bc000bf3a9
parentf0fe4596445610b30a910b78a4e491c7f087151e (diff)
downloadmate-desktop-ffb083eba37dbfb8407ac41f5a134d2e64f69cec.tar.bz2
mate-desktop-ffb083eba37dbfb8407ac41f5a134d2e64f69cec.tar.xz
Fix g_settings_list_schemas deprecation
-rw-r--r--libmate-desktop/mate-gsettings.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libmate-desktop/mate-gsettings.c b/libmate-desktop/mate-gsettings.c
index e37bc91..8f20e98 100644
--- a/libmate-desktop/mate-gsettings.c
+++ b/libmate-desktop/mate-gsettings.c
@@ -37,10 +37,22 @@
gboolean
mate_gsettings_schema_exists (const gchar* schema)
{
+#if GLIB_CHECK_VERSION (2, 40, 0)
+ GSettingsSchemaSource *schema_source;
+ GSettingsSchema *schema_schema;
+#else
const char * const *schemas;
- gboolean schema_exists;
gint i;
+#endif
+ gboolean schema_exists;
+#if GLIB_CHECK_VERSION (2, 40, 0)
+ schema_source = g_settings_schema_source_get_default();
+ schema_schema = g_settings_schema_source_lookup (schema_source, schema, FALSE);
+ schema_exists = (schema_schema != NULL);
+ if (schema_schema)
+ g_settings_schema_unref (schema_schema);
+#else
schemas = g_settings_list_schemas ();
schema_exists = FALSE;
@@ -50,6 +62,7 @@ mate_gsettings_schema_exists (const gchar* schema)
break;
}
}
+#endif
return schema_exists;
}