Exemplo n.º 1
0
static CCSStringList
scanConfigDir (char * filePath)
{
    CCSStringList  ret = NULL;
    struct dirent  **nameList;
    char           *pos;
    int            nFile, i;

    nFile = scandir (filePath, &nameList, profileNameFilter, NULL);
    if (nFile <= 0)
	return NULL;

    for (i = 0; i < nFile; ++i)
    {
	pos = strrchr (nameList[i]->d_name, '.');
	if (pos)
	{
	    CCSString *pString = malloc (sizeof (CCSString));
	    *pos = 0;

	    pString->value = strdup (nameList[i]->d_name);
	    pString->refCount = 1;

	    if (strcmp (nameList[i]->d_name, DEFAULTPROF) != 0)
		ret = ccsStringListAppend (ret, pString);
	}

	free (nameList[i]);
    }

    free (nameList);
    
    return ret;
}
Exemplo n.º 2
0
static CCSStringList
scanConfigDir (char * filePath)
{
    CCSStringList  ret = NULL;
    struct dirent  **nameList;
    char           *pos;
    int            nFile, i;

    nFile = scandir (filePath, &nameList, profileNameFilter, NULL);
    if (nFile <= 0)
        return NULL;

    for (i = 0; i < nFile; i++)
    {
        pos = strrchr (nameList[i]->d_name, '.');
        if (pos)
        {
            *pos = 0;

            if (strcmp (nameList[i]->d_name, DEFAULTPROF) != 0)
                ret = ccsStringListAppend (ret, strdup (nameList[i]->d_name));
        }

        free (nameList[i]);
    }

    free (nameList);

    return ret;
}
static CCSStringList
getExistingProfiles (CCSContext *)
{
    QDir dir (KGlobal::dirs()->saveLocation ("config", QString::null, false),
	      				     "compizrc.*");

    QStringList files = dir.entryList();
    CCSStringList ret = NULL;

    QStringList::iterator it;

    for (it = files.begin(); it != files.end(); it++)
    {
	QString str = (*it);

	if (str.length() > 9)
	{
	    QString profile = str.right (str.length() - 9);

	    if (!profile.isEmpty() )
		ret = ccsStringListAppend (ret, 
		    strdup (profile.toAscii().constData()));
	}
    }

    return ret;
}
Exemplo n.º 4
0
CCSStringList ccsGetListFromStringArray (char ** array, int num)
{
    CCSStringList rv = NULL;
    int i;

    for (i = 0; i < num; i++)
    {
	CCSString *str = calloc (1, sizeof (CCSString));
	
	str->value = strdup (array[i]);
	str->refCount = 1;

	rv = ccsStringListAppend (rv, str);
    }

    return rv;
}
Exemplo n.º 5
0
CCSStringList ccsGetStringListFromValueList (CCSSettingValueList list)
{
    CCSStringList rv = NULL;

    while (list)
    {
	CCSString *str = calloc (1, sizeof (CCSString));
	
	str->value = strdup (list->data->value.asString);
	str->refCount = 1;

	rv = ccsStringListAppend (rv, str);
	list = list->next;
    }

    return rv;
}