Exemplo n.º 1
0
/*	Constructs a URL_Struct from the the specified URL to the prefetch_list based
	on the value of the pre subtag. 
*/
PUBLIC void
PRE_AddToList(MWContext* context, char* url, double value) 
{
	/* Construct a new URL_Struct with this url, and Prefetch priority */
	URL_Struct* urls;
	PrefetchURLStruct *pus = XP_NEW(PrefetchURLStruct); 

	if (!pre_enabled || !value || !pus || !pre_OKToPrefetch(url))
		return;

	urls = NET_CreateURLStruct(url, NET_DONT_RELOAD);
	if (!urls)
		return;
	
	urls->priority = Prefetch_priority;
	urls->load_background = TRUE;
					
	if (prefetch_list == NULL)
	{
		prefetch_list = XP_ListNew();
	}
	
	pus->prevalue = value;
	pus->URL_s = urls;

	XP_ListAddObjectToEnd(prefetch_list, pus);
}
Exemplo n.º 2
0
void XFE_ABDirListView::propertyCB(DIR_Server *dir)
{	
	int which = XP_ListGetNumFromObject(m_directories, dir);
#if defined(DEBUG_tao)
	printf("\nXFE_ABDirListView::propertyCB=%d\n", which);
#endif
	if (!which) {
		/* new
		 */
		const int *selected;
		int count;		
		m_outliner->getSelection(&selected, &count);
		int pos = 0;
		if (m_nDirs > 0 && count && selected) {
			// Insert dir at position
			pos = selected[0];
			DIR_Server *prev_dir;
			prev_dir = (DIR_Server*)XP_ListGetObjectNum(m_directories,
														pos+1);
			XP_ListInsertObjectAfter(m_directories, prev_dir, dir);
			pos = pos+1;
		}
		else {
			XP_ListAddObjectToEnd(m_directories, dir);
			pos = m_nDirs+1;
		}
			
		// Repaint 
		m_nDirs = XP_ListCount(m_directories);
		m_outliner->change(0, m_nDirs, m_nDirs);
		// Set selection
		m_outliner->selectItemExclusive(pos);
		notifyInterested(XFE_ABDirListView::dirSelect, (void *) dir);
	}/* if */
	else
		m_outliner->invalidateLine(which);
		
	DIR_SaveServerPreferences(m_directories);
	if (m_deleted_directories) {
		DIR_CleanUpServerPreferences(m_deleted_directories);
		m_deleted_directories = NULL;
	}/* if */

	getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
}