diff options
author | infirit <[email protected]> | 2014-11-04 17:19:46 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-11-04 17:19:46 +0100 |
commit | 31d04419e1f358073b906177edda67d8858fc125 (patch) | |
tree | 8c7d14d4cf08ca1c67a9ab261f51d0c1e18dd806 | |
parent | 76b46abb26152fabd3cadcff9abe7d1a6e7481f8 (diff) | |
download | mate-session-manager-31d04419e1f358073b906177edda67d8858fc125.tar.bz2 mate-session-manager-31d04419e1f358073b906177edda67d8858fc125.tar.xz |
gsettings: stop using g_settings_list_schemas()
Based on gnome-session commit: 880379a8dd7181351ba49c579a5278d19eadc6b3
From Ryan Lortie <[email protected]>
-rw-r--r-- | mate-session/gsm-autostart-app.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/mate-session/gsm-autostart-app.c b/mate-session/gsm-autostart-app.c index 04cc8e6..360cfae 100644 --- a/mate-session/gsm-autostart-app.c +++ b/mate-session/gsm-autostart-app.c @@ -278,36 +278,33 @@ static gboolean setup_gsettings_condition_monitor (GsmAutostartApp *app, const char *key) { - GSettings *settings; - const char * const *schemas; + GSettingsSchemaSource *source; + GSettingsSchema *schema; + GSettings *settings; char **elems; - gboolean schema_exists; - guint i; - gboolean retval; + gboolean retval = FALSE; char *signal; - elems = g_strsplit (key, " ", 2); + retval = FALSE; + + elems = g_strsplit (key, " ", 2); + if (elems == NULL) - return FALSE; - if (elems[0] == NULL || elems[1] == NULL) { - g_strfreev (elems); - return FALSE; - } + goto out; - schemas = g_settings_list_schemas (); - schema_exists = FALSE; - for (i = 0; schemas[i] != NULL; i++) { - if (g_str_equal (schemas[i], elems[0])) { - schema_exists = TRUE; - break; - } - } + if (elems[0] == NULL || elems[1] == NULL) + goto out; - if (schema_exists == FALSE) - return FALSE; + source = g_settings_schema_source_get_default (); + + schema = g_settings_schema_source_lookup (source, elems[0], TRUE); + + if (schema == NULL) + goto out; - settings = g_settings_new (elems[0]); + settings = g_settings_new_full (schema, NULL, NULL); retval = g_settings_get_boolean (settings, elems[1]); + g_settings_schema_unref (schema); signal = g_strdup_printf ("changed::%s", elems[1]); g_signal_connect (G_OBJECT (settings), signal, @@ -316,6 +313,7 @@ setup_gsettings_condition_monitor (GsmAutostartApp *app, app->priv->condition_settings = settings; +out: g_strfreev (elems); return retval; |