Beispiel #1
0
Bool * ccsGetBoolArrayFromValueList (CCSSettingValueList list, int *num)
{
    Bool * rv = NULL;
    int length = ccsSettingValueListLength (list);
    int i;

    if (length)
    {
	rv = calloc (length, sizeof (Bool));
	if (!rv)
	    return NULL;
    }

    for (i = 0; i < length; i++, list = list->next)
	rv[i] = list->data->value.asBool;

    *num = length;

    return rv;
}
Beispiel #2
0
CCSSettingColorValue * ccsGetColorArrayFromValueList (CCSSettingValueList list,
						      int *num)
{
    CCSSettingColorValue * rv = NULL;
    int length = ccsSettingValueListLength (list);
    int i;

    if (length)
    {
	rv = calloc (length, sizeof (CCSSettingColorValue));
	if (!rv)
	    return NULL;
    }

    for (i = 0; i < length; i++, list = list->next)
	memcpy (&rv[i], &list->data->value.asColor,
		sizeof (CCSSettingColorValue));

    *num = length;

    return rv;
}
static void
ccpSettingToValue (CompObject      *object,
		   CCSSetting      *s,
		   CompOptionValue *v)
{
    if (s->type != TypeList)
	ccpSetValueToValue (object, s->value, v, s->type);
    else
    {
	CCSSettingValueList list;
	int                 i = 0;

	ccsGetList (s, &list);

	if (!ccpCCSTypeToCompizType (s->info.forList.listType, &v->list.type))
	    v->list.type = CompOptionTypeBool;

	if ((strcmp (s->name, "active_plugins") == 0) &&
	    (strcmp (s->parent->name, CORE_VTABLE_NAME) == 0))
	{
	    ccpConvertPluginList (s, list, v);
	}
	else
	{
    	    v->list.nValue = ccsSettingValueListLength (list);
    	    v->list.value  = calloc (v->list.nValue, sizeof (CompOptionValue));

    	    while (list)
    	    {
    		ccpSetValueToValue (object, list->data,
    				    &v->list.value[i],
				    s->info.forList.listType);
		list = list->next;
		i++;
	    }
	}
    }
}