예제 #1
0
파일: jpilot.c 프로젝트: jan0sch/sylpheed
/*
* Check whether JPilot PDB or PC3 file has changed by comparing
* with cached data.
* return: TRUE if file has changed.
*/
static gboolean jpilot_check_files( JPilotFile *pilotFile ) {
	gboolean retVal = TRUE;
	GStatBuf filestat;
	gchar *pcFile;

	/* Check main file */
	if( addrcache_check_file( pilotFile->addressCache, pilotFile->path ) )
		return TRUE;

	/* Test PC3 file */
	if( ! pilotFile->havePC3 ) return FALSE;
	pcFile = jpilot_get_pc3_file( pilotFile );
	if( pcFile == NULL ) return FALSE;

	if( 0 == g_lstat( pcFile, &filestat ) ) {
		if( filestat.st_mtime == pilotFile->pc3ModifyTime ) retVal = FALSE;
	}
	g_free( pcFile );
	return retVal;
}
예제 #2
0
/* ============================================================================================ */
gint vcard_read_data( VCardFile *cardFile ) {
	g_return_val_if_fail( cardFile != NULL, -1 );

	cardFile->retVal = MGU_SUCCESS;
	cardFile->addressCache->accessFlag = FALSE;
	if( addrcache_check_file( cardFile->addressCache, cardFile->path ) ) {
		addrcache_clear( cardFile->addressCache );
		vcard_open_file( cardFile );
		if( cardFile->retVal == MGU_SUCCESS ) {
			/* Read data into the list */
			vcard_read_file( cardFile );
			vcard_close_file( cardFile );

			/* Mark cache */
			addrcache_mark_file( cardFile->addressCache, cardFile->path );
			cardFile->addressCache->modified = FALSE;
			cardFile->addressCache->dataRead = TRUE;
		}
	}
	return cardFile->retVal;
}
예제 #3
0
/*
* Test whether file was modified since last access.
* Return: TRUE if file was modified.
*/
gboolean vcard_get_modified( VCardFile *cardFile ) {
	g_return_val_if_fail( cardFile != NULL, FALSE );
	cardFile->addressCache->modified =
		addrcache_check_file( cardFile->addressCache, cardFile->path );
	return cardFile->addressCache->modified;
}