diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-11-10 06:13:39 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-11-10 06:13:39 +0000 |
commit | 30d77dbdd0591aad49e7cbff3b32f0ad82e73fad (patch) | |
tree | d99e3e6d8d2c29f3721d77f359a4b2fb0d48435d /src | |
parent | 5635cc2b41f14dcb2538915c4b3e89ba98a170b1 (diff) |
show more descriptive error when address index failed to read.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2342 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/addressbook.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/addressbook.c b/src/addressbook.c index 5b2ca41d..442db7cc 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -2803,34 +2803,36 @@ void addressbook_read_file(void) AddressIndex *addrIndex = NULL; debug_print( "Reading address index...\n" ); - if( _addressIndex_ ) { - debug_print( "address book already read!!!\n" ); + if (_addressIndex_) { + debug_print("address book already read!\n"); return; } addrIndex = addrindex_create_index(); /* Use new address book index. */ - addrindex_set_file_path( addrIndex, get_rc_dir() ); - addrindex_set_file_name( addrIndex, ADDRESSBOOK_INDEX_FILE ); - addrindex_read_data( addrIndex ); - if( addrIndex->retVal == MGU_NO_FILE ) { + addrindex_set_file_path(addrIndex, get_rc_dir()); + addrindex_set_file_name(addrIndex, ADDRESSBOOK_INDEX_FILE); + addrindex_read_data(addrIndex); + if (addrIndex->retVal == MGU_NO_FILE) { /* Conversion required */ - debug_print( "Converting...\n" ); - if( addressbook_convert( addrIndex ) ) { + debug_print("Converting...\n"); + if (addressbook_convert(addrIndex)) { _addressIndex_ = addrIndex; } - } - else if( addrIndex->retVal == MGU_SUCCESS ) { + } else if (addrIndex->retVal == MGU_SUCCESS) { _addressIndex_ = addrIndex; - } - else { + } else { + gchar msg[1024]; + /* Error reading address book */ - debug_print( "Could not read address index.\n" ); - addrindex_print_index( addrIndex, stdout ); - alertpanel( _( "Address Book Error" ), - _( "Could not read address index" ), - GTK_STOCK_CLOSE, NULL, NULL ); + debug_print("Could not read address index.\n"); + addrindex_print_index(addrIndex, stdout); + g_snprintf(msg, sizeof(msg), + _("Could not read address index:\n\n%s%c%s"), + addrIndex->filePath, G_DIR_SEPARATOR, + addrIndex->fileName); + alertpanel_message(_("Address Book Error"), msg, ALERT_ERROR); } debug_print( "done.\n" ); } |