Fix gsettings tool crash

When no path is provided for the schema, we have call
g_settings_new() instead of g_settings_new_with_path()
passing a NULL path.

This was crashing the tool on start since an assertion was
recently added to g_settings_new_with_path() to refuse NULL.
This commit is contained in:
Milan Bouchet-Valat 2010-06-19 18:33:26 +02:00
parent a768953760
commit 62939f5e45

View File

@ -132,7 +132,10 @@ handle_get (gint *argc,
schema = (*argv)[1]; schema = (*argv)[1];
key = (*argv)[2]; key = (*argv)[2];
if (path)
settings = g_settings_new_with_path (schema, path); settings = g_settings_new_with_path (schema, path);
else
settings = g_settings_new (schema);
v = g_settings_get_value (settings, key); v = g_settings_get_value (settings, key);
g_print ("%s\n", g_variant_print (v, FALSE)); g_print ("%s\n", g_variant_print (v, FALSE));
@ -193,7 +196,10 @@ handle_set (gint *argc,
key = (*argv)[2]; key = (*argv)[2];
value = (*argv)[3]; value = (*argv)[3];
if (path)
settings = g_settings_new_with_path (schema, path); settings = g_settings_new_with_path (schema, path);
else
settings = g_settings_new (schema);
v = g_settings_get_value (settings, key); v = g_settings_get_value (settings, key);
type = g_variant_get_type (v); type = g_variant_get_type (v);