inital gtk2 patch
[claws.git] / src / importldif.c
index eb35d6aadcee188357433e0682dc8472c6550ca0..ef30fb142bb119062612353ba0e0dca11cc72f30 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001 Match Grun
+ * Copyright (C) 2001-2003 Match Grun
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
  */
 
 /*
- * Edit VCard address book data.
+ * Import LDIF address book data.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "manage_window.h"
 #include "mgutils.h"
 #include "ldif.h"
+#include "utils.h"
 
-#define IMPORTLDIF_GUESS_NAME "LDIF Import"
+#define IMPORTLDIF_GUESS_NAME      "LDIF Import"
 
 #define PAGE_FILE_INFO             0
 #define PAGE_ATTRIBUTES            1
 #define PAGE_FINISH                2
 
-#define IMPORTLDIF_WIDTH           380
+#define IMPORTLDIF_WIDTH           390
 #define IMPORTLDIF_HEIGHT          300
 
-#define FIELDS_N_COLS              3
+#define FIELDS_N_COLS              4
+#define FIELDS_COL_WIDTH_RESERVED  10
 #define FIELDS_COL_WIDTH_SELECT    10
 #define FIELDS_COL_WIDTH_FIELD     140
 #define FIELDS_COL_WIDTH_ATTRIB    140
 
 typedef enum {
-       FIELD_COL_SELECT  = 0,
-       FIELD_COL_FIELD   = 1,
-       FIELD_COL_ATTRIB  = 2
+       FIELD_COL_RESERVED = 0,
+       FIELD_COL_SELECT   = 1,
+       FIELD_COL_FIELD    = 2,
+       FIELD_COL_ATTRIB   = 3
 } ImpLdif_FieldColPos;
 
+/**
+ * LDIF dialog definition.
+ */
 static struct _ImpLdif_Dlg {
        GtkWidget *window;
        GtkWidget *notebook;
-       GtkWidget *file_entry;
-       GtkWidget *name_entry;
+       GtkWidget *entryFile;
+       GtkWidget *entryName;
        GtkWidget *clist_field;
-       GtkWidget *name_ldif;
-       GtkWidget *name_attrib;
-       GtkWidget *check_select;
+       GtkWidget *entryField;
+       GtkWidget *entryAttrib;
+       GtkWidget *checkSelect;
+       GtkWidget *btnModify;
        GtkWidget *labelBook;
        GtkWidget *labelFile;
        GtkWidget *labelRecords;
@@ -99,20 +106,85 @@ static LdifFile *_ldifFile_ = NULL;
 static GdkPixmap *markxpm;
 static GdkBitmap *markxpmmask;
 
+/**
+ * Structure of error message table.
+ */
+typedef struct _ErrMsgTableEntry ErrMsgTableEntry;
+struct _ErrMsgTableEntry {
+       gint    code;
+       gchar   *description;
+};
+
+static gchar *_errMsgUnknown_ = N_( "Unknown" );
+
+/**
+ * Lookup table of error messages for general errors. Note that a NULL
+ * description signifies the end of the table.
+ */
+static ErrMsgTableEntry _lutErrorsLDIF_[] = {
+       { MGU_SUCCESS,          N_("Success") },
+       { MGU_BAD_ARGS,         N_("Bad arguments") },
+       { MGU_NO_FILE,          N_("File not specified") },
+       { MGU_OPEN_FILE,        N_("Error opening file") },
+       { MGU_ERROR_READ,       N_("Error reading file") },
+       { MGU_EOF,              N_("End of file encountered") },
+       { MGU_OO_MEMORY,        N_("Error allocating memory") },
+       { MGU_BAD_FORMAT,       N_("Bad file format") },
+       { MGU_ERROR_WRITE,      N_("Error writing to file") },
+       { MGU_OPEN_DIRECTORY,   N_("Error opening directory") },
+       { MGU_NO_PATH,          N_("No path specified") },
+       { 0,                    NULL }
+};
+
+/**
+ * Lookup message for specified error code.
+ * \param lut  Lookup table.
+ * \param code Code to lookup.
+ * \return Description associated to code.
+ */
+static gchar *imp_ldif_err2string( ErrMsgTableEntry lut[], gint code ) {
+        gchar *desc = NULL;
+        ErrMsgTableEntry entry;
+        gint i;
+
+        for( i = 0; ; i++ ) {
+                entry = lut[ i ];
+                if( entry.description == NULL ) break;
+                if( entry.code == code ) {
+                        desc = entry.description;
+                        break;
+                }
+        }
+        if( ! desc ) {
+               desc = _errMsgUnknown_;
+        }
+        return desc;
+}
+
+/**
+ * Display message in status field.
+ * \param msg Message to display.
+ */
 static void imp_ldif_status_show( gchar *msg ) {
        if( impldif_dlg.statusbar != NULL ) {
-               gtk_statusbar_pop( GTK_STATUSBAR(impldif_dlg.statusbar), impldif_dlg.status_cid );
+               gtk_statusbar_pop( GTK_STATUSBAR(impldif_dlg.statusbar),
+                       impldif_dlg.status_cid );
                if( msg ) {
-                       gtk_statusbar_push( GTK_STATUSBAR(impldif_dlg.statusbar), impldif_dlg.status_cid, msg );
+                       gtk_statusbar_push(
+                               GTK_STATUSBAR(impldif_dlg.statusbar),
+                               impldif_dlg.status_cid, msg );
                }
        }
 }
 
+/**
+ * Select and display status message appropriate for the page being displayed.
+ */
 static void imp_ldif_message( void ) {
        gchar *sMsg = NULL;
        gint pageNum;
 
-       pageNum = gtk_notebook_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
+       pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
        if( pageNum == PAGE_FILE_INFO ) {
                sMsg = _( "Please specify address book name and file to import." );
        }
@@ -125,20 +197,10 @@ static void imp_ldif_message( void ) {
        imp_ldif_status_show( sMsg );
 }
 
-static gchar *imp_ldif_guess_file( AddressBookFile *abf ) {
-       gchar *newFile = NULL;
-       GList *fileList = NULL;
-       gint fileNum = 1;
-       fileList = addrbook_get_bookfile_list( abf );
-       if( fileList ) {
-               fileNum = 1 + abf->maxValue;
-       }
-       newFile = addrbook_gen_new_file_name( fileNum );
-       g_list_free( fileList );
-       fileList = NULL;
-       return newFile;
-}
-
+/**
+ * Update list with data for current row.
+ * \param clist List to update.
+ */
 static void imp_ldif_update_row( GtkCList *clist ) {
        Ldif_FieldRec *rec;
        gchar *text[ FIELDS_N_COLS ];
@@ -148,9 +210,10 @@ static void imp_ldif_update_row( GtkCList *clist ) {
        row = impldif_dlg.rowIndSelect;
 
        rec = gtk_clist_get_row_data( clist, row );
-       text[ FIELD_COL_SELECT ] = "";
-       text[ FIELD_COL_FIELD  ] = rec->tagName;
-       text[ FIELD_COL_ATTRIB ] = rec->userName;
+       text[ FIELD_COL_RESERVED ] = "";
+       text[ FIELD_COL_SELECT   ] = "";
+       text[ FIELD_COL_FIELD    ] = rec->tagName;
+       text[ FIELD_COL_ATTRIB   ] = rec->userName;
 
        gtk_clist_freeze( clist );
        gtk_clist_remove( clist, row );
@@ -160,13 +223,23 @@ static void imp_ldif_update_row( GtkCList *clist ) {
        else {
                gtk_clist_insert( clist, row, text );
        }
-       if( rec->selected )
-               gtk_clist_set_pixmap( clist, row, FIELD_COL_SELECT, markxpm, markxpmmask );
+       if( rec->selected ) {
+               gtk_clist_set_pixmap(
+                       clist, row, FIELD_COL_SELECT, markxpm, markxpmmask );
+       }
+       if( rec->reserved ) {
+               gtk_clist_set_pixmap(
+                       clist, row, FIELD_COL_RESERVED, markxpm, markxpmmask );
+       }
 
        gtk_clist_set_row_data( clist, row, rec );
        gtk_clist_thaw( clist );
 }
 
+/**
+ * Load list with LDIF fields read from file.
+ * \param ldf LDIF control data.
+ */
 static void imp_ldif_load_fields( LdifFile *ldf ) {
        GtkCList *clist = GTK_CLIST(impldif_dlg.clist_field);
        GList *node, *list;
@@ -182,16 +255,21 @@ static void imp_ldif_load_fields( LdifFile *ldf ) {
                Ldif_FieldRec *rec = node->data;
                gint row;
 
-               if( ! rec->reserved ) {
-                       text[ FIELD_COL_SELECT ] = "";
-                       text[ FIELD_COL_FIELD  ] = rec->tagName;
-                       text[ FIELD_COL_ATTRIB ] = rec->userName;
-                       row = gtk_clist_append( clist, text );
-                       gtk_clist_set_row_data( clist, row, rec );
-                       if( rec->selected )
-                               gtk_clist_set_pixmap( clist, row, FIELD_COL_SELECT, markxpm, markxpmmask );
-                       impldif_dlg.rowCount++;
+               text[ FIELD_COL_RESERVED ] = "";
+               text[ FIELD_COL_SELECT   ] = "";
+               text[ FIELD_COL_FIELD    ] = rec->tagName;
+               text[ FIELD_COL_ATTRIB   ] = rec->userName;
+               row = gtk_clist_append( clist, text );
+               gtk_clist_set_row_data( clist, row, rec );
+               if( rec->selected ) {
+                       gtk_clist_set_pixmap( clist, row,
+                               FIELD_COL_SELECT, markxpm, markxpmmask );
+               }
+               if( rec->reserved ) {
+                       gtk_clist_set_pixmap( clist, row,
+                               FIELD_COL_RESERVED, markxpm, markxpmmask );
                }
+               impldif_dlg.rowCount++;
                node = g_list_next( node );
        }
        g_list_free( list );
@@ -199,36 +277,96 @@ static void imp_ldif_load_fields( LdifFile *ldf ) {
        ldif_set_accessed( ldf, FALSE );
 }
 
-static void imp_ldif_field_list_selected( GtkCList *clist, gint row, gint column, GdkEvent *event, gpointer data ) {
+/**
+ * Callback function when list iterm selected.
+ * \param clist List widget.
+ * \param row   Row.
+ * \param col   Column.
+ * \param event Event object.
+ * \param data  User data.
+ */
+static void imp_ldif_field_list_selected(
+               GtkCList *clist, gint row, gint column, GdkEvent *event,
+               gpointer data )
+{
        Ldif_FieldRec *rec = gtk_clist_get_row_data( clist, row );
 
        impldif_dlg.rowIndSelect = row;
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_attrib), "" );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryAttrib), "" );
        if( rec ) {
-               gtk_label_set_text( GTK_LABEL(impldif_dlg.name_ldif), rec->tagName );
+               /* Update widget contents */
+               gtk_label_set_text(
+                       GTK_LABEL(impldif_dlg.entryField), rec->tagName );
                if( rec->userName )
-                       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_attrib), rec->userName );
+                       gtk_entry_set_text(
+                               GTK_ENTRY(impldif_dlg.entryAttrib), rec->userName );
                gtk_toggle_button_set_active(
-                       GTK_TOGGLE_BUTTON( impldif_dlg.check_select),
+                       GTK_TOGGLE_BUTTON( impldif_dlg.checkSelect),
                        rec->selected );
+
+               /* Disable widgets for reserved fields */
+               gtk_widget_set_sensitive(
+                       impldif_dlg.entryAttrib, ! rec->reserved );
+               gtk_widget_set_sensitive(
+                       impldif_dlg.checkSelect, ! rec->reserved );
+               gtk_widget_set_sensitive(
+                       impldif_dlg.btnModify,   ! rec->reserved );
        }
-       gtk_widget_grab_focus(impldif_dlg.name_attrib);
+       gtk_widget_grab_focus(impldif_dlg.entryAttrib);
 }
 
-static void imp_ldif_field_list_toggle( GtkCList *clist, GdkEventButton *event, gpointer data ) {
-       if( ! event ) return;
-       if( impldif_dlg.rowIndSelect < 0 ) return;
+/**
+ * Callback function to toggle selected LDIF field.
+ * \param clist List to update.
+ * \param event Event object.
+ * \param data  Data.
+ */
+static gboolean imp_ldif_field_list_toggle(
+               GtkCList *clist, GdkEventButton *event, gpointer data )
+{
+       Ldif_FieldRec *rec;
+       gboolean toggle = FALSE;
+
+       if( ! event ) return FALSE;
+       if( impldif_dlg.rowIndSelect < 0 ) return FALSE;
        if( event->button == 1 ) {
-               if( event->type == GDK_2BUTTON_PRESS ) {
-                       Ldif_FieldRec *rec = gtk_clist_get_row_data( clist, impldif_dlg.rowIndSelect );
-                       if( rec ) {
-                               rec->selected = ! rec->selected;
-                               imp_ldif_update_row( clist );
-                       }
+               /* If single click in select column */
+               if( event->type == GDK_BUTTON_PRESS ) {
+                       gint x = event->x;
+                       gint y = event->y;
+                       gint row, col;
+
+                       gtk_clist_get_selection_info( clist, x, y, &row, &col );
+                       if( col != FIELD_COL_SELECT ) return FALSE;
+                       if( row > impldif_dlg.rowCount ) return FALSE;
+
+                       /* Set row */
+                       impldif_dlg.rowIndSelect = row;
+                       toggle = TRUE;
+               }
+
+               /* If double click anywhere in row */
+               else if( event->type == GDK_2BUTTON_PRESS ) {
+                       toggle = TRUE;
+               }
+       }
+       /* Toggle field selection */
+       if( toggle ) {
+               rec = gtk_clist_get_row_data(
+                       clist, impldif_dlg.rowIndSelect );
+               if( rec ) {
+                       ldif_field_toggle( rec );
+                       imp_ldif_update_row( clist );
                }
        }
+       return FALSE;
 }
 
+/**
+ * Callback function to update LDIF field data from input fields.
+ * \param widget Widget (button).
+ * \param data   User data.
+ */
 static void imp_ldif_modify_pressed( GtkWidget *widget, gpointer data ) {
        GtkCList *clist = GTK_CLIST(impldif_dlg.clist_field);
        Ldif_FieldRec *rec;
@@ -238,20 +376,22 @@ static void imp_ldif_modify_pressed( GtkWidget *widget, gpointer data ) {
        row = impldif_dlg.rowIndSelect;
        rec = gtk_clist_get_row_data( clist, impldif_dlg.rowIndSelect );
 
-       g_free( rec->userName );
-       rec->userName = g_strdup( gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.name_attrib), 0, -1 ) );
-       rec->selected = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( impldif_dlg.check_select) );
+       ldif_field_set_name( rec, gtk_editable_get_chars(
+               GTK_EDITABLE(impldif_dlg.entryAttrib), 0, -1 ) );
+       ldif_field_set_selected( rec, gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON( impldif_dlg.checkSelect) ) );
        imp_ldif_update_row( clist );
        gtk_clist_select_row( clist, row, 0 );
-       gtk_label_set_text( GTK_LABEL(impldif_dlg.name_ldif), "" );
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_attrib), "" );
-       gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( impldif_dlg.check_select), FALSE );
+       gtk_label_set_text( GTK_LABEL(impldif_dlg.entryField), "" );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryAttrib), "" );
+       gtk_toggle_button_set_active(
+               GTK_TOGGLE_BUTTON( impldif_dlg.checkSelect), FALSE );
 }
 
-/*
-* Move off fields page.
-* return: TRUE if OK to move off page.
-*/
+/**
+ * Test whether we can move off fields page.
+ * \return <i>TRUE</i> if OK to move off page.
+ */
 static gboolean imp_ldif_field_move() {
        gboolean retVal = FALSE;
        gchar *newFile;
@@ -264,7 +404,7 @@ static gboolean imp_ldif_field_move() {
        abf = addrbook_create_book();
        addrbook_set_path( abf, _imp_addressIndex_->filePath );
        addrbook_set_name( abf, impldif_dlg.nameBook );
-       newFile = imp_ldif_guess_file( abf );
+       newFile = addrbook_guess_next_file( abf );
        addrbook_set_file( abf, newFile );
        g_free( newFile );
 
@@ -281,10 +421,10 @@ static gboolean imp_ldif_field_move() {
        return retVal;
 }
 
-/*
-* Move off fields page.
-* return: TRUE if OK to move off page.
-*/
+/**
+ * Test whether we can move off file page.
+ * \return <i>TRUE</i> if OK to move off page.
+ */
 static gboolean imp_ldif_file_move() {
        gboolean retVal = FALSE;
        gchar *sName;
@@ -292,10 +432,10 @@ static gboolean imp_ldif_file_move() {
        gchar *sMsg = NULL;
        gboolean errFlag = FALSE;
 
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.file_entry), 0, -1 );
+       sFile = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.entryFile), 0, -1 );
        g_strchug( sFile ); g_strchomp( sFile );
 
-       sName = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.name_entry), 0, -1 );
+       sName = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.entryName), 0, -1 );
        g_strchug( sName ); g_strchomp( sName );
 
        g_free( impldif_dlg.nameBook );
@@ -303,18 +443,18 @@ static gboolean imp_ldif_file_move() {
        impldif_dlg.nameBook = sName;
        impldif_dlg.fileName = sFile;
 
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.file_entry), sFile );
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_entry), sName );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryFile), sFile );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryName), sName );
 
        if( *sFile == '\0'|| strlen( sFile ) < 1 ) {
                sMsg = _( "Please select a file." );
-               gtk_widget_grab_focus(impldif_dlg.file_entry);
+               gtk_widget_grab_focus(impldif_dlg.entryFile);
                errFlag = TRUE;
        }
 
        if( *sName == '\0'|| strlen( sName ) < 1 ) {
                if( ! errFlag ) sMsg = _( "Address book name must be supplied." );
-               gtk_widget_grab_focus(impldif_dlg.name_entry);
+               gtk_widget_grab_focus(impldif_dlg.entryName);
                errFlag = TRUE;
        }
 
@@ -336,52 +476,59 @@ static gboolean imp_ldif_file_move() {
        return retVal;
 }
 
-/*
+/**
  * Display finish page.
  */
 static void imp_ldif_finish_show() {
-       gchar *recs;
        gchar *sMsg;
+       gchar *name;
 
-       recs = g_strdup_printf( "%d", _ldifFile_->importCount );
-       gtk_label_set_text( GTK_LABEL(impldif_dlg.labelBook),
-               gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.name_entry), 0, -1 ) );
+       name = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.entryName), 0, -1 );
+       gtk_label_set_text( GTK_LABEL(impldif_dlg.labelBook), name );
+       g_free( name );
        gtk_label_set_text( GTK_LABEL(impldif_dlg.labelFile), _ldifFile_->path );
-       gtk_label_set_text( GTK_LABEL(impldif_dlg.labelRecords), recs );
-       g_free( recs );
+       gtk_label_set_text( GTK_LABEL(impldif_dlg.labelRecords), itos( _ldifFile_->importCount ) );
        gtk_widget_set_sensitive( impldif_dlg.btnPrev, FALSE );
        gtk_widget_set_sensitive( impldif_dlg.btnNext, FALSE );
        if( _ldifFile_->retVal == MGU_SUCCESS ) {
                sMsg = _( "LDIF file imported successfully." );
        }
        else {
-               sMsg = mgu_error2string( _ldifFile_->retVal );
+               sMsg = imp_ldif_err2string( _lutErrorsLDIF_, _ldifFile_->retVal );
        }
        imp_ldif_status_show( sMsg );
        gtk_widget_grab_focus(impldif_dlg.btnCancel);
 }
 
+/**
+ * Callback function to select previous page.
+ * \param widget Widget (button).
+ */
 static void imp_ldif_prev( GtkWidget *widget ) {
        gint pageNum;
 
-       pageNum = gtk_notebook_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
+       pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
        if( pageNum == PAGE_ATTRIBUTES ) {
                /* Goto file page stuff */
-               gtk_notebook_set_page(
+               gtk_notebook_set_current_page(
                        GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FILE_INFO );
                gtk_widget_set_sensitive( impldif_dlg.btnPrev, FALSE );
        }
        imp_ldif_message();
 }
 
+/**
+ * Callback function to select next page.
+ * \param widget Widget (button).
+ */
 static void imp_ldif_next( GtkWidget *widget ) {
        gint pageNum;
 
-       pageNum = gtk_notebook_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
+       pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
        if( pageNum == PAGE_FILE_INFO ) {
                /* Goto attributes stuff */
                if( imp_ldif_file_move() ) {
-                       gtk_notebook_set_page(
+                       gtk_notebook_set_current_page(
                                GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_ATTRIBUTES );
                        imp_ldif_message();
                        gtk_widget_set_sensitive( impldif_dlg.btnPrev, TRUE );
@@ -393,25 +540,35 @@ static void imp_ldif_next( GtkWidget *widget ) {
        else if( pageNum == PAGE_ATTRIBUTES ) {
                /* Goto finish stuff */
                if( imp_ldif_field_move() ) {
-                       gtk_notebook_set_page(
+                       gtk_notebook_set_current_page(
                                GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FINISH );
                        imp_ldif_finish_show();
                }
        }
 }
 
+/**
+ * Callback function to cancel and close dialog.
+ * \param widget Widget (button).
+ * \param data   User data.
+ */
 static void imp_ldif_cancel( GtkWidget *widget, gpointer data ) {
        gint pageNum;
 
-       pageNum = gtk_notebook_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
+       pageNum = gtk_notebook_get_current_page( GTK_NOTEBOOK(impldif_dlg.notebook) );
        if( pageNum != PAGE_FINISH ) {
                impldif_dlg.cancelled = TRUE;
        }
        gtk_main_quit();
 }
 
+/**
+ * Callback function to accept LDIF file selection.
+ * \param widget Widget (button).
+ * \param data   User data.
+ */
 static void imp_ldif_file_ok( GtkWidget *widget, gpointer data ) {
-       gchar *sFile;
+       const gchar *sFile;
        AddressFileSelection *afs;
        GtkWidget *fileSel;
 
@@ -420,39 +577,51 @@ static void imp_ldif_file_ok( GtkWidget *widget, gpointer data ) {
        sFile = gtk_file_selection_get_filename( GTK_FILE_SELECTION(fileSel) );
 
        afs->cancelled = FALSE;
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.file_entry), sFile );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryFile), sFile );
        gtk_widget_hide( afs->fileSelector );
        gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( impldif_dlg.file_entry );
+       gtk_widget_grab_focus( impldif_dlg.entryFile );
 }
 
+/**
+ * Callback function to cancel LDIF file selection dialog.
+ * \param widget Widget (button).
+ * \param data   User data.
+ */
 static void imp_ldif_file_cancel( GtkWidget *widget, gpointer data ) {
        AddressFileSelection *afs = ( AddressFileSelection * ) data;
        afs->cancelled = TRUE;
        gtk_widget_hide( afs->fileSelector );
        gtk_grab_remove( afs->fileSelector );
-       gtk_widget_grab_focus( impldif_dlg.file_entry );
+       gtk_widget_grab_focus( impldif_dlg.entryFile );
 }
 
+/**
+ * Create LDIF file selection dialog.
+ * \param afs Address file selection data.
+ */
 static void imp_ldif_file_select_create( AddressFileSelection *afs ) {
        GtkWidget *fileSelector;
 
        fileSelector = gtk_file_selection_new( _("Select LDIF File") );
        gtk_file_selection_hide_fileop_buttons( GTK_FILE_SELECTION(fileSelector) );
-       gtk_signal_connect( GTK_OBJECT (GTK_FILE_SELECTION(fileSelector)->ok_button),
-               "clicked", GTK_SIGNAL_FUNC (imp_ldif_file_ok), ( gpointer ) afs );
-       gtk_signal_connect( GTK_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
-               "clicked", GTK_SIGNAL_FUNC (imp_ldif_file_cancel), ( gpointer ) afs );
+       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->ok_button),
+                         "clicked", G_CALLBACK (imp_ldif_file_ok), ( gpointer ) afs );
+       g_signal_connect( G_OBJECT (GTK_FILE_SELECTION(fileSelector)->cancel_button),
+                         "clicked", G_CALLBACK (imp_ldif_file_cancel), ( gpointer ) afs );
        afs->fileSelector = fileSelector;
        afs->cancelled = TRUE;
 }
 
+/**
+ * Callback function to display LDIF file selection dialog.
+ */
 static void imp_ldif_file_select( void ) {
        gchar *sFile;
        if( ! _imp_ldif_file_selector_.fileSelector )
                imp_ldif_file_select_create( & _imp_ldif_file_selector_ );
 
-       sFile = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.file_entry), 0, -1 );
+       sFile = gtk_editable_get_chars( GTK_EDITABLE(impldif_dlg.entryFile), 0, -1 );
        gtk_file_selection_set_filename(
                GTK_FILE_SELECTION( _imp_ldif_file_selector_.fileSelector ),
                sFile );
@@ -461,24 +630,43 @@ static void imp_ldif_file_select( void ) {
        gtk_grab_add( _imp_ldif_file_selector_.fileSelector );
 }
 
+/**
+ * Callback function to handle dialog close event.
+ * \param widget Widget (dialog).
+ * \param event  Event object.
+ * \param data   User data.
+ */
 static gint imp_ldif_delete_event( GtkWidget *widget, GdkEventAny *event, gpointer data ) {
        imp_ldif_cancel( widget, data );
        return TRUE;
 }
 
-static void imp_ldif_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data ) {
+/**
+ * Callback function to respond to dialog key press events.
+ * \param widget Widget.
+ * \param event  Event object.
+ * \param data   User data.
+ */
+static gboolean imp_ldif_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data ) {
        if (event && event->keyval == GDK_Escape) {
                imp_ldif_cancel( widget, data );
        }
+       return FALSE;
 }
 
+/**
+ * Format notebook "file" page.
+ * \param pageNum Page (tab) number.
+ * \param pageLbl Page (tab) label.
+ */
 static void imp_ldif_page_file( gint pageNum, gchar *pageLbl ) {
        GtkWidget *vbox;
        GtkWidget *table;
        GtkWidget *label;
-       GtkWidget *file_entry;
-       GtkWidget *name_entry;
-       GtkWidget *file_btn;
+       GtkWidget *entryFile;
+       GtkWidget *entryName;
+       GtkWidget *btnFile;
+       GtkTooltips *toolTip;
        gint top;
 
        vbox = gtk_vbox_new(FALSE, 8);
@@ -506,10 +694,16 @@ static void imp_ldif_page_file( gint pageNum, gchar *pageLbl ) {
                GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
-       name_entry = gtk_entry_new();
-       gtk_table_attach(GTK_TABLE(table), name_entry, 1, 2, top, (top + 1),
+       entryName = gtk_entry_new();
+       gtk_table_attach(GTK_TABLE(table), entryName, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entryName, _( 
+               "Specify the name for the address book that will " \
+               "be created from the LDIF file data." ),
+               NULL );
+
        /* Second row */
        top = 1;
        label = gtk_label_new(_("File Name"));
@@ -517,45 +711,62 @@ static void imp_ldif_page_file( gint pageNum, gchar *pageLbl ) {
                GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
-       file_entry = gtk_entry_new();
-       gtk_table_attach(GTK_TABLE(table), file_entry, 1, 2, top, (top + 1),
+       entryFile = gtk_entry_new();
+       gtk_table_attach(GTK_TABLE(table), entryFile, 1, 2, top, (top + 1),
                GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
-       file_btn = gtk_button_new_with_label( _(" ... "));
-       gtk_table_attach(GTK_TABLE(table), file_btn, 2, 3, top, (top + 1),
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entryFile,
+               _( "The full file specification of the LDIF file to import." ),
+               NULL );
+
+       btnFile = gtk_button_new_with_label( _(" ... "));
+       gtk_table_attach(GTK_TABLE(table), btnFile, 2, 3, top, (top + 1),
                GTK_FILL, 0, 3, 0);
 
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, btnFile,
+               _( "Select the LDIF file to import." ),
+               NULL );
+
        gtk_widget_show_all(vbox);
 
        /* Button handler */
-       gtk_signal_connect(GTK_OBJECT(file_btn), "clicked",
-                          GTK_SIGNAL_FUNC(imp_ldif_file_select), NULL);
+       g_signal_connect(G_OBJECT(btnFile), "clicked",
+                        G_CALLBACK(imp_ldif_file_select), NULL);
 
-       impldif_dlg.file_entry = file_entry;
-       impldif_dlg.name_entry = name_entry;
+       impldif_dlg.entryFile = entryFile;
+       impldif_dlg.entryName = entryName;
 }
 
+/**
+ * Format notebook fields page.
+ * \param pageNum Page (tab) number.
+ * \param pageLbl Page (tab) label.
+ */
 static void imp_ldif_page_fields( gint pageNum, gchar *pageLbl ) {
        GtkWidget *vbox;
        GtkWidget *vboxt;
        GtkWidget *vboxb;
-       GtkWidget *buttonMod;
-
        GtkWidget *table;
        GtkWidget *label;
        GtkWidget *clist_swin;
        GtkWidget *clist_field;
-       GtkWidget *name_ldif;
-       GtkWidget *name_attrib;
-       GtkWidget *check_select;
+       GtkWidget *entryField;
+       GtkWidget *entryAttrib;
+       GtkWidget *checkSelect;
+       GtkWidget *btnModify;
+       GtkWidget *eventBox;
+       GtkTooltips *toolTip;
        gint top;
 
        gchar *titles[ FIELDS_N_COLS ];
        gint i;
 
-       titles[ FIELD_COL_SELECT ] = _("S");
-       titles[ FIELD_COL_FIELD  ] = _("LDIF Field");
-       titles[ FIELD_COL_ATTRIB ] = _("Attribute Name");
+       titles[ FIELD_COL_RESERVED ] = _("R");
+       titles[ FIELD_COL_SELECT   ] = _("S");
+       titles[ FIELD_COL_FIELD    ] = _("LDIF Field Name");
+       titles[ FIELD_COL_ATTRIB   ] = _("Attribute Name");
 
        vbox = gtk_vbox_new(FALSE, 8);
        gtk_container_add( GTK_CONTAINER( impldif_dlg.notebook ), vbox );
@@ -580,16 +791,23 @@ static void imp_ldif_page_fields( gint pageNum, gchar *pageLbl ) {
 
        clist_field = gtk_clist_new_with_titles( FIELDS_N_COLS, titles );
        gtk_container_add( GTK_CONTAINER(clist_swin), clist_field );
-       gtk_clist_set_selection_mode( GTK_CLIST(clist_field), GTK_SELECTION_BROWSE );
-       gtk_clist_set_column_width(
-                       GTK_CLIST(clist_field), FIELD_COL_SELECT, FIELDS_COL_WIDTH_SELECT );
-       gtk_clist_set_column_width(
-                       GTK_CLIST(clist_field), FIELD_COL_FIELD, FIELDS_COL_WIDTH_FIELD );
-       gtk_clist_set_column_width(
-                       GTK_CLIST(clist_field), FIELD_COL_ATTRIB, FIELDS_COL_WIDTH_ATTRIB );
-
-       for( i = 0; i < FIELDS_N_COLS; i++ )
-               GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist_field)->column[i].button, GTK_CAN_FOCUS);
+       gtk_clist_set_selection_mode(
+               GTK_CLIST(clist_field), GTK_SELECTION_BROWSE );
+       gtk_clist_set_column_width( GTK_CLIST(clist_field),
+               FIELD_COL_RESERVED, FIELDS_COL_WIDTH_RESERVED );
+       gtk_clist_set_column_width( GTK_CLIST(clist_field),
+               FIELD_COL_SELECT, FIELDS_COL_WIDTH_SELECT );
+       gtk_clist_set_column_width( GTK_CLIST(clist_field),
+               FIELD_COL_FIELD, FIELDS_COL_WIDTH_FIELD );
+       gtk_clist_set_column_width( GTK_CLIST(clist_field),
+               FIELD_COL_ATTRIB, FIELDS_COL_WIDTH_ATTRIB );
+
+       /* Remove focus capability for column headers */
+       for( i = 0; i < FIELDS_N_COLS; i++ ) {
+               GTK_WIDGET_UNSET_FLAGS(
+                       GTK_CLIST(clist_field)->column[i].button,
+                       GTK_CAN_FOCUS);
+       }
 
        /* Lower area - Edit area */
        vboxb = gtk_vbox_new( FALSE, 4 );
@@ -604,50 +822,103 @@ static void imp_ldif_page_fields( gint pageNum, gchar *pageLbl ) {
        /* First row */
        top = 0;
        label = gtk_label_new(_("LDIF Field"));
-       gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
+       gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
+               GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
-       name_ldif = gtk_label_new( "" );
-       gtk_misc_set_alignment(GTK_MISC(name_ldif), 0.01, 0.5);
-       gtk_table_attach(GTK_TABLE(table), name_ldif, 1, 3, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
+       entryField = gtk_label_new( "" );
+       gtk_misc_set_alignment(GTK_MISC(entryField), 0.01, 0.5);
+       gtk_table_attach(GTK_TABLE(table), entryField, 1, 3, top, (top + 1),
+               GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
        /* Second row */
        ++top;
        label = gtk_label_new(_("Attribute"));
-       gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
+       gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
+               GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
 
-       name_attrib = gtk_entry_new();
-       gtk_table_attach(GTK_TABLE(table), name_attrib, 1, 3, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
+       entryAttrib = gtk_entry_new();
+       gtk_table_attach(GTK_TABLE(table), entryAttrib, 1, 3, top, (top + 1),
+               GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
+
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, entryAttrib,
+               _( "The LDIF field can be renamed to the User Attribute name." ),
+               NULL );
 
        /* Next row */
        ++top;
-       label = gtk_label_new(_("Select"));
-       gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
+       label = gtk_label_new( _( "???" ) );
+       /*
+       gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1),
+               GTK_FILL, 0, 0, 0);
+       */
+       gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
+
+       /*
+        * Use an event box to attach some help in the form of a tooltip.
+        * Tried this for the clist but it looked bad.
+        */
+       eventBox = gtk_event_box_new();
+       gtk_container_add( GTK_CONTAINER(eventBox), label );
+       gtk_table_attach(GTK_TABLE(table), eventBox, 0, 1, top, (top + 1),
+               GTK_FILL, 0, 0, 0);
 
-       check_select = gtk_check_button_new();
-       gtk_table_attach(GTK_TABLE(table), check_select, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, eventBox, _(
+               "Choose the LDIF field that will be renamed or selected " \
+               "for import in the list above. Reserved fields (marked " \
+               "with a tick in the \"R\" column), are automatically " \
+               "imported and cannot be renamed. A single click in the " \
+               "Select (\"S\") column will select the field for import " \
+               "with a tick. A single click anywhere in the row will " \
+               "select that field for rename in the input area below " \
+               "the list. A double click anywhere in the row will also " \
+               "select the field for import."
+               ), NULL );
+
+
+       checkSelect = gtk_check_button_new_with_label( _( "Select for Import" ) );
+       gtk_table_attach(GTK_TABLE(table), checkSelect, 1, 2, top, (top + 1),
+               GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
 
-       buttonMod = gtk_button_new_with_label( _("Modify"));
-       gtk_table_attach(GTK_TABLE(table), buttonMod, 2, 3, top, (top + 1), GTK_FILL, 0, 3, 0);
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, checkSelect,
+               _( "Select the LDIF field for import into the address book." ),
+               NULL );
+
+       btnModify = gtk_button_new_with_label( _(" Modify "));
+       gtk_table_attach(GTK_TABLE(table), btnModify, 2, 3, top, (top + 1),
+               GTK_FILL, 0, 3, 0);
+
+       toolTip = gtk_tooltips_new();
+       gtk_tooltips_set_tip( toolTip, btnModify,
+               _( "This button will update the list above with the data supplied." ),
+               NULL );
 
        gtk_widget_show_all(vbox);
 
        /* Event handlers */
-       gtk_signal_connect( GTK_OBJECT(clist_field), "select_row",
-                       GTK_SIGNAL_FUNC(imp_ldif_field_list_selected), NULL );
-       gtk_signal_connect( GTK_OBJECT(clist_field), "button_press_event",
-                       GTK_SIGNAL_FUNC(imp_ldif_field_list_toggle), NULL );
-       gtk_signal_connect( GTK_OBJECT(buttonMod), "clicked",
-                       GTK_SIGNAL_FUNC(imp_ldif_modify_pressed), NULL );
-
-       impldif_dlg.clist_field  = clist_field;
-       impldif_dlg.name_ldif    = name_ldif;
-       impldif_dlg.name_attrib  = name_attrib;
-       impldif_dlg.check_select = check_select;
+       g_signal_connect( G_OBJECT(clist_field), "select_row",
+                         G_CALLBACK(imp_ldif_field_list_selected), NULL );
+       g_signal_connect( G_OBJECT(clist_field), "button_press_event",
+                         G_CALLBACK(imp_ldif_field_list_toggle), NULL );
+       g_signal_connect( G_OBJECT(btnModify), "clicked",
+                         G_CALLBACK(imp_ldif_modify_pressed), NULL );
+
+       impldif_dlg.clist_field = clist_field;
+       impldif_dlg.entryField  = entryField;
+       impldif_dlg.entryAttrib = entryAttrib;
+       impldif_dlg.checkSelect = checkSelect;
+       impldif_dlg.btnModify   = btnModify;
 }
 
+/**
+ * Format notebook finish page.
+ * \param pageNum Page (tab) number.
+ * \param pageLbl Page (tab) label.
+ */
 static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
        GtkWidget *vbox;
        GtkWidget *table;
@@ -665,17 +936,18 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
        gtk_widget_show( label );
        gtk_notebook_set_tab_label(
                GTK_NOTEBOOK( impldif_dlg.notebook ),
-               gtk_notebook_get_nth_page( GTK_NOTEBOOK( impldif_dlg.notebook ), pageNum ), label );
+               gtk_notebook_get_nth_page( GTK_NOTEBOOK( impldif_dlg.notebook ), pageNum ),
+               label );
 
        table = gtk_table_new(3, 2, FALSE);
        gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
        gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
        gtk_table_set_row_spacings(GTK_TABLE(table), 8);
-       gtk_table_set_col_spacings(GTK_TABLE(table), 8 );
+       gtk_table_set_col_spacings(GTK_TABLE(table), 8);
 
        /* First row */
        top = 0;
-       label = gtk_label_new(_("Address Book :"));
+       label = gtk_label_new( _( "Address Book :" ) );
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 
@@ -685,7 +957,7 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
 
        /* Second row */
        top++;
-       label = gtk_label_new(_("File Name :"));
+       label = gtk_label_new( _( "File Name :" ) );
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 
@@ -695,7 +967,7 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
 
        /* Third row */
        top++;
-       label = gtk_label_new(_("Records :"));
+       label = gtk_label_new( _("Records Imported :") );
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
        gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
 
@@ -708,6 +980,9 @@ static void imp_ldif_page_finish( gint pageNum, gchar *pageLbl ) {
        impldif_dlg.labelRecords = labelRecs;
 }
 
+/**
+ * Create main dialog decorations (excluding notebook pages).
+ */
 static void imp_ldif_dialog_create() {
        GtkWidget *window;
        GtkWidget *vbox;
@@ -720,18 +995,18 @@ static void imp_ldif_dialog_create() {
        GtkWidget *hsbox;
        GtkWidget *statusbar;
 
-       window = gtk_window_new(GTK_WINDOW_DIALOG);
-       gtk_widget_set_usize(window, IMPORTLDIF_WIDTH, IMPORTLDIF_HEIGHT );
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_widget_set_size_request(window, IMPORTLDIF_WIDTH, IMPORTLDIF_HEIGHT );
        gtk_container_set_border_width( GTK_CONTAINER(window), 0 );
        gtk_window_set_title( GTK_WINDOW(window), _("Import LDIF file into Address Book") );
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal(GTK_WINDOW(window), TRUE); 
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(imp_ldif_delete_event),
-                          NULL );
-       gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
-                          GTK_SIGNAL_FUNC(imp_ldif_key_pressed),
-                          NULL );
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(imp_ldif_delete_event),
+                        NULL );
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(imp_ldif_key_pressed),
+                        NULL );
 
        vbox = gtk_vbox_new(FALSE, 4);
        gtk_widget_show(vbox);
@@ -764,12 +1039,12 @@ static void imp_ldif_dialog_create() {
        gtk_widget_grab_default(btnNext);
 
        /* Button handlers */
-       gtk_signal_connect(GTK_OBJECT(btnPrev), "clicked",
-                          GTK_SIGNAL_FUNC(imp_ldif_prev), NULL);
-       gtk_signal_connect(GTK_OBJECT(btnNext), "clicked",
-                          GTK_SIGNAL_FUNC(imp_ldif_next), NULL);
-       gtk_signal_connect(GTK_OBJECT(btnCancel), "clicked",
-                          GTK_SIGNAL_FUNC(imp_ldif_cancel), NULL);
+       g_signal_connect(G_OBJECT(btnPrev), "clicked",
+                        G_CALLBACK(imp_ldif_prev), NULL);
+       g_signal_connect(G_OBJECT(btnNext), "clicked",
+                        G_CALLBACK(imp_ldif_next), NULL);
+       g_signal_connect(G_OBJECT(btnCancel), "clicked",
+                        G_CALLBACK(imp_ldif_cancel), NULL);
 
        gtk_widget_show_all(vbox);
 
@@ -784,6 +1059,9 @@ static void imp_ldif_dialog_create() {
 
 }
 
+/**
+ * Create import LDIF dialog.
+ */
 static void imp_ldif_create() {
        imp_ldif_dialog_create();
        imp_ldif_page_file( PAGE_FILE_INFO, _( "File Info" ) );
@@ -792,6 +1070,12 @@ static void imp_ldif_create() {
        gtk_widget_show_all( impldif_dlg.window );
 }
 
+/**
+ * Import LDIF file.
+ * \param  addrIndex Address index.
+ * \return Address book file of imported data, or <i>NULL</i> if import
+ *         was cancelled.
+ */
 AddressBookFile *addressbook_imp_ldif( AddressIndex *addrIndex ) {
        _importedBook_ = NULL;
        _imp_addressIndex_ = addrIndex;
@@ -803,18 +1087,18 @@ AddressBookFile *addressbook_imp_ldif( AddressIndex *addrIndex ) {
        manage_window_set_transient(GTK_WINDOW(impldif_dlg.window));
        gtk_widget_grab_default(impldif_dlg.btnNext);
 
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_entry), IMPORTLDIF_GUESS_NAME );
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.file_entry), "" );
-       gtk_label_set_text( GTK_LABEL(impldif_dlg.name_ldif), "" );
-       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.name_attrib), "" );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryName), IMPORTLDIF_GUESS_NAME );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryFile), "" );
+       gtk_label_set_text( GTK_LABEL(impldif_dlg.entryField), "" );
+       gtk_entry_set_text( GTK_ENTRY(impldif_dlg.entryAttrib), "" );
        gtk_clist_clear( GTK_CLIST(impldif_dlg.clist_field) );
-       gtk_notebook_set_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FILE_INFO );
+       gtk_notebook_set_current_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FILE_INFO );
        gtk_widget_set_sensitive( impldif_dlg.btnPrev, FALSE );
        gtk_widget_set_sensitive( impldif_dlg.btnNext, TRUE );
        stock_pixmap_gdk( impldif_dlg.window, STOCK_PIXMAP_MARK,
                          &markxpm, &markxpmmask );
        imp_ldif_message();
-       gtk_widget_grab_focus(impldif_dlg.file_entry);
+       gtk_widget_grab_focus(impldif_dlg.entryFile);
 
        impldif_dlg.rowIndSelect = -1;
        impldif_dlg.rowCount = 0;
@@ -840,6 +1124,8 @@ AddressBookFile *addressbook_imp_ldif( AddressIndex *addrIndex ) {
 }
 
 /*
-* End of Source.
-*/
+ * ============================================================================
+ * End of Source.
+ * ============================================================================
+ */