Esempio n. 1
0
/*
* ============================================================================================
* Read file into list. Main entry point
* Return: TRUE if file read successfully.
* ============================================================================================
*/
gint jpilot_read_data( JPilotFile *pilotFile ) {
	name_order = FAMILY_LAST;
	convert_charcode = FALSE;

	if( conv_is_ja_locale() ) {
		name_order = FAMILY_FIRST;
		convert_charcode = TRUE;
	}

	g_return_val_if_fail( pilotFile != NULL, -1 );

	pilotFile->retVal = MGU_SUCCESS;
	pilotFile->accessFlag = FALSE;

	if( jpilot_check_files( pilotFile ) ) {
		addrcache_clear( pilotFile->addressCache );
		jpilot_read_metadata( pilotFile );
		if( pilotFile->retVal == MGU_SUCCESS ) {
			jpilot_setup_labels( pilotFile );
			jpilot_build_category_list( pilotFile );
			pilotFile->retVal = jpilot_read_file( pilotFile );
			if( pilotFile->retVal == MGU_SUCCESS ) {
				jpilot_remove_empty( pilotFile );
				jpilot_mark_files( pilotFile );
				pilotFile->addressCache->modified = FALSE;
				pilotFile->addressCache->dataRead = TRUE;
			}
		}
	}
	return pilotFile->retVal;
}
Esempio n. 2
0
/**
 * Read file into list. Main entry point
 * \param pilotFile  JPilot control data.
 * \return Error/status code. <code>MGU_SUCCESS</code> if data read
 *         successfully.
 */
gint jpilot_read_data( JPilotFile *pilotFile ) {
	const gchar *cur_locale;

	name_order = FAMILY_LAST;
	convert_charcode = FALSE;

	cur_locale = conv_get_current_locale();

	if( g_strncasecmp( cur_locale, "ja", 2 ) == 0 ) {
		name_order = FAMILY_FIRST;
	}

	if( conv_get_current_charset() == C_EUC_JP ) {
		convert_charcode = TRUE;
	}

	g_return_val_if_fail( pilotFile != NULL, -1 );

	pilotFile->retVal = MGU_SUCCESS;
	pilotFile->addressCache->accessFlag = FALSE;
	if( jpilot_check_files( pilotFile ) ) {
		addrcache_clear( pilotFile->addressCache );
		jpilot_read_metadata( pilotFile );
		if( pilotFile->retVal == MGU_SUCCESS ) {
			pilotFile->retVal = jpilot_read_file( pilotFile );
			if( pilotFile->retVal == MGU_SUCCESS ) {
				pilotFile->addressCache->modified = FALSE;
				pilotFile->addressCache->dataRead = TRUE;
			}
		}
	}
	return pilotFile->retVal;
}
Esempio n. 3
0
/*
* Test whether file was modified since last access.
* Return: TRUE if file was modified.
*/
gboolean jpilot_get_modified( JPilotFile *pilotFile ) {
	g_return_val_if_fail( pilotFile != NULL, FALSE );
	return jpilot_check_files( pilotFile );
}
Esempio n. 4
0
/*
* Test whether file was modified since last access.
* Return: TRUE if file was modified.
*/
gboolean jpilot_get_modified( JPilotFile *pilotFile ) {
	g_return_val_if_fail( pilotFile != NULL, FALSE );
	pilotFile->addressCache->modified = jpilot_check_files( pilotFile );
	return pilotFile->addressCache->modified;
}