gboolean property_context_from_string(PropertyContext * ctx, const gchar * str)
{
    if (ctx == NULL) {
        return FALSE;
    }
    return mkdg_g_value_from_string(&(ctx->value), str);
}
void mkdg_g_value_from_string_test()
{
    /* Test int */
    GValue intValue={0};
    g_value_init(&intValue, G_TYPE_INT);

    mkdg_g_value_from_string(&intValue, "0");
    g_assert_cmpint(0, ==, g_value_get_int(&intValue));

    mkdg_g_value_from_string(&intValue, "-1");
    g_assert_cmpint(-1, ==, g_value_get_int(&intValue));

    g_value_unset(&intValue);

    /* Test boolean */
    GValue booleanValue={0};
    g_value_init(&booleanValue, G_TYPE_BOOLEAN);

    mkdg_g_value_from_string(&booleanValue, "1");
    g_assert(g_value_get_boolean(&booleanValue));

    mkdg_g_value_from_string(&booleanValue, "0");
    g_assert(!g_value_get_boolean(&booleanValue));

    mkdg_g_value_from_string(&booleanValue, "T");
    g_assert(g_value_get_boolean(&booleanValue));

    mkdg_g_value_from_string(&booleanValue, "F");
    g_assert(!g_value_get_boolean(&booleanValue));

    mkdg_g_value_from_string(&booleanValue, "true");
    g_assert(g_value_get_boolean(&booleanValue));

    mkdg_g_value_from_string(&booleanValue, "false");
    g_assert(!g_value_get_boolean(&booleanValue));

    g_value_unset(&booleanValue);
}
GValue *backend_command_get_key_value(const gchar * key, GValue * value)
{
    gchar cmdBuf[COMMAND_BUFFER_SIZE];
    gchar *cKey = mkdg_backend_get_key(backend, NULL, key, NULL);
#ifdef USE_GSETTINGS
    g_snprintf(cmdBuf, COMMAND_BUFFER_SIZE, "gsettings get %s %s",
	       QUOTE_ME(PROJECT_SCHEMA_ID), cKey);
#else
    g_snprintf(cmdBuf, COMMAND_BUFFER_SIZE, "gconftool-2 --get  %s/%s",
	       QUOTE_ME(PROJECT_GCONF2_SCHEMA_DIR), cKey);
#endif
    gchar *retStr = command_run_obtain_output(cmdBuf);

#ifdef USE_GSETTINGS
    /* gsettings prepend 'uint32 ' before actual value */
    if (G_VALUE_TYPE(value) == G_TYPE_UINT) {
	gint offset = strlen("uint32 ");
	retStr += offset;
    }
#endif
    mkdg_g_value_from_string(value, retStr);
    return value;
}