Beispiel #1
0
void pgDomain::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (!expandedKids)
    {
        expandedKids = true;

        browser->RemoveDummyChild(this);

        // Log
        wxLogInfo(wxT("Adding child object to domain %s"), GetIdentifier().c_str());
        if (GetConnection()->BackendMinimumVersion(7, 4))
            browser->AppendCollection(this, constraintFactory);
    }

    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Name"), GetName());
        properties->AppendItem(_("OID"), GetOid());
        properties->AppendItem(_("Owner"), GetOwner());
        properties->AppendItem(_("Base type"), GetBasetype());
        if (GetDimensions())
            properties->AppendItem(_("Dimensions"), GetDimensions());
        if (GetCollationOid() > 0)
            properties->AppendItem(_("Collation"), GetQuotedCollation());
        properties->AppendItem(_("Default"), GetDefault());
        properties->AppendYesNoItem(_("Not NULL?"), GetNotNull());
        properties->AppendYesNoItem(_("System domain?"), GetSystemObject());
        properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));

        if (!GetLabels().IsEmpty())
        {
            wxArrayString seclabels = GetProviderLabelArray();
            if (seclabels.GetCount() > 0)
            {
                for (unsigned int index = 0 ; index < seclabels.GetCount() - 1 ; index += 2)
                {
                    properties->AppendItem(seclabels.Item(index), seclabels.Item(index + 1));
                }
            }
        }
    }
}
Beispiel #2
0
int* wiimenu_buildgamelist(char* root, gamelistentry* gamelist, int max, \
			   gamelistentry *gamesunk, gamelistentry *gamesfdd, gamelistentry *gameshdd)
{
	int i = 0;
	int *sizes = malloc(sizeof(int) * BASETYPE_COUNT);
	gamelistentry *games;
	memset(sizes, 0, BASETYPE_COUNT * sizeof(int));
	DIR_ITER * dirIter = NULL;
	dirIter = diropen(root);
	if(dirIter == NULL) {
#ifdef DEBUG_NP2
		printf("Couldn't open %s\n", root);
		sleep(5);
#endif //DEBUG_NP2
		return NULL;
	}
	char filename[MAXPATHLEN];
        struct stat filestat;
	int res;
	int type, basetype;
        for(i = 0; i < max; i++) {
		if(time_to_leave)
			break;
		res = dirnext(dirIter, filename, &filestat);
		
		if(res != 0)
			break;
		char *origname = strdup(filename);
		MakeLowercase(filename);
		type = GetFiletype(filename);
		basetype = GetBasetype(type);
		
		switch(basetype) {
			case BASETYPE_UNKNOWN:
				games = gamesunk;
				break;
			case BASETYPE_FDD:
				games = gamesfdd;
				break;
			case BASETYPE_HDD:
				games = gameshdd;
				break;
		}
		games[sizes[basetype]].path = calloc(strlen(filename) + 1, 1);
		strncpy(games[sizes[basetype]].path, filename, strlen(filename));
		games[sizes[basetype]].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1;
		games[sizes[basetype]].type = type;
		games[sizes[basetype]].basetype = basetype;
		
		if(games[sizes[basetype]].isdir) {
			if(strcmp(filename, "..") == 0)
				sizes[basetype]--;
			else if(strcmp(filename, ".") == 0)
				sizes[basetype]--;
			else {
				games[sizes[basetype]].name = calloc(strlen(origname) + 1, 1);
				strncpy(games[sizes[basetype]].name, origname, strlen(origname) + 1);
			}
		}else{
			games[sizes[basetype]].name = calloc(strlen(origname) + 1, 1);
			strncpy(games[sizes[basetype]].name, origname, strlen(origname) + 1);
		}
		sizes[basetype]++;
	}
	
	// Sort the file lists
        if(sizes[BASETYPE_UNKNOWN] >= 0)
		qsort(gamesunk, sizes[BASETYPE_UNKNOWN], sizeof(gamelistentry), sortgames_cb);
        if(sizes[BASETYPE_HDD] >= 0)
		qsort(gameshdd, sizes[BASETYPE_HDD], sizeof(gamelistentry), sortgames_cb);
        if(sizes[BASETYPE_FDD] >= 0)
		qsort(gamesfdd, sizes[BASETYPE_FDD], sizeof(gamelistentry), sortgames_cb);
	
	dirclose(dirIter);	// close directory
	return sizes;
}