Ejemplo n.º 1
0
void FskGtkWindowMenuBarClear(FskGtkWindow win)
{
	menuBars entryBar = win->menu;
	menuItems submenu = NULL;
	
	// Remove IDs
	entryBar = FskListRemoveFirst(&win->menu);
	while(entryBar) {
		// Remove menuItems
		submenu = FskListRemoveFirst(&entryBar->menulist);
		while(submenu) {
			FskMemPtrDispose(submenu);
			submenu = FskListRemoveFirst(&entryBar->menulist);
		}

		entryBar->menulist = NULL;
		FskMemPtrDispose(entryBar);

		// Next
		entryBar = FskListRemoveFirst(&win->menu);
	}

	// Remove menuBar
	// TODO? disable GDK events when do such clean?
	{
		GList *children, *iter;
		children = gtk_container_get_children(GTK_CONTAINER(win->menubar));
		for(iter = children; iter != NULL; iter = g_list_next(iter))
  			gtk_widget_destroy(GTK_WIDGET(iter->data));
		g_list_free(children);
	}
	gtk_widget_hide(win->menubar);

	win->menu = NULL;
}
Ejemplo n.º 2
0
void FskGtkWindowMenuBarClear(FskGtkWindow win)
{
	menuBars entryBar = win->menu;
	menuItems item = NULL;
	GtkWidget* menuBar = NULL;

	entryBar = FskListRemoveFirst(&win->menu);
	while(entryBar) {
		// Remove menuItems
		item = FskListRemoveFirst(&entryBar->menulist);
		while(item) {
			FskMemPtrDispose(item);
			item = FskListRemoveFirst(&entryBar->menulist);
		}

		// Remove menuBar
		menuBar = entryBar->item;
		gtk_container_remove(GTK_CONTAINER(win->menubar), menuBar);
		FskMemPtrDispose(entryBar);

		// Next
		entryBar = FskListRemoveFirst(&win->menu);
	}
	
	win->menu = NULL;
}
Ejemplo n.º 3
0
void removeFromQueue(FskAudioOut audioOut, UInt32 what) {
	int freed = 0;
	androidAudioExt *ext;

	FskAudioNativePrintfVerbose("removeFromQueue %x", what);
	if (audioOut->blocks) {
		int err;
		err = FskMutexTrylock(audioOut->blocks->mutex);
		if (err != 0) {
			FskAudioNativePrintfMinimal("removeUnusedFrom Queue - trylock was busy");
			return;
		}
		while (true) {
			FskAudioOutBlock block = (FskAudioOutBlock)audioOut->blocks->list;
			if ((NULL == block) || ((what == kUsed) & (false == block->done)))
				break;
			block = (FskAudioOutBlock)FskListRemoveFirst((FskList*)&audioOut->blocks->list);
			if (block->silence)
				FskMemPtrDispose(block->data);
			else if (audioOut->doneCB) {
				if (block->dataSize && (what != kAll)) {
					ext = (androidAudioExt*)audioOut->ext;
					FskAudioNativePrintfMinimal("TRASHING audioblock with some data left: %u bytes - (total left %u)", (unsigned)block->dataSize, (unsigned)(ext->bytesEnqueued - block->dataSize));
					ext->bytesEnqueued -= block->dataSize;
				}
				(audioOut->doneCB)(audioOut, audioOut->doneRefCon, block->refCon, true);
			}
			FskMemPtrDispose(block->frameSizes);
			FskMemPtrDispose(block);
			freed++;
		}
		FskMutexRelease(audioOut->blocks->mutex);
	}
}
Ejemplo n.º 4
0
void terminateVolumeList() {
	volInfo vol;
	while ( NULL != (vol = FskListRemoveFirst((void **)&volumeList)) ) {
		FskMemPtrDispose(vol->name);
		FskMemPtrDispose(vol->mountPoint);
		FskMemPtrDispose(vol->typeStr);
		FskMemPtrDispose(vol);
	}
}
Ejemplo n.º 5
0
// ------------------------------------------------------------------------
void FskAssociativeArrayDispose(FskAssociativeArray array)
{
	FskAssociativeArrayNameList	list;

	if (!array)
		return;

	while ((list = FskListRemoveFirst((void**)(void*)&array->arrayHead)))
		FskMemPtrDispose(list);

	FskMemPtrDispose(array);
}
Ejemplo n.º 6
0
static FskErr KprCoAPClientNextAutoToken(KprCoAPClient self, KprMemoryBlock *token)
{
	FskErr err = kFskErrNone;
	UInt32 max, value;

	if (self->recycleTokens) {
		*token = FskListRemoveFirst(&self->recycleTokens);
		(void)KprRetain(*token);
		return kFskErrNone;
	}

	switch (self->nextTokenBytes) {
		case 1:
			max = 0xffU;
			break;

		case 2:
			max = 0xffffU;
			break;

		case 3:
			max = 0xffffffU;
			break;

		case 4:
			max = 0xffffffffU;
			break;

		default:
			return kFskErrMemFull;
	}

	value = self->nextTokenId;
	value = FskEndianU32_NtoL(value);

	bailIfError(KprMemoryBlockNew(self->nextTokenBytes, &value, token));

	if (self->nextTokenId >= max) {
		self->nextTokenBytes += 1;
		self->nextTokenId = 0;
	} else {
		self->nextTokenId += 1;
	}

bail:
	return err;
}