summaryrefslogtreecommitdiff
path: root/mate-session/gsm-autostart-app.c
diff options
context:
space:
mode:
Diffstat (limited to 'mate-session/gsm-autostart-app.c')
-rw-r--r--mate-session/gsm-autostart-app.c42
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;