static void imp_ldif_next( GtkWidget *widget ) { gint pageNum; 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_current_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_ATTRIBUTES ); imp_ldif_message(); gtk_widget_set_sensitive( impldif_dlg.btnPrev, TRUE ); } else { gtk_widget_set_sensitive( impldif_dlg.btnPrev, FALSE ); } } else if( pageNum == PAGE_ATTRIBUTES ) { /* Goto finish stuff */ if( imp_ldif_field_move() ) { gtk_notebook_set_current_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FINISH ); imp_ldif_finish_show(); } } }
/** * Callback function to select next page. * \param widget Widget (button). */ static void imp_ldif_next( GtkWidget *widget ) { gint pageNum; 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_current_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_ATTRIBUTES ); imp_ldif_message(); gtk_widget_set_sensitive( impldif_dlg.btnPrev, TRUE ); gtk_widget_hide( impldif_dlg.btnNext ); gtk_widget_show( impldif_dlg.btnProceed ); gtk_widget_set_sensitive( impldif_dlg.btnProceed, TRUE ); } else { gtk_widget_set_sensitive( impldif_dlg.btnPrev, FALSE ); _ldifFile_->dirtyFlag = TRUE; } } else if( pageNum == PAGE_ATTRIBUTES ) { /* Goto finish stuff */ if( imp_ldif_field_move() ) { gtk_notebook_set_current_page( GTK_NOTEBOOK(impldif_dlg.notebook), PAGE_FINISH ); gtk_button_set_label(GTK_BUTTON(impldif_dlg.btnCancel), GTK_STOCK_CLOSE); imp_ldif_finish_show(); } } }
AddressBookFile *addressbook_imp_ldif_file( AddressIndex *addrIndex, const gchar *file, const gchar *book_name ) { gchar *fsfile; GList *node, *list; gboolean ret = FALSE; g_return_val_if_fail(addrIndex != NULL, NULL); g_return_val_if_fail(file != NULL, NULL); g_return_val_if_fail(book_name != NULL, NULL); debug_print("addressbook_imp_ldif_file: file: %s name: %s\n", file, book_name); _importedBook_ = NULL; _imp_addressIndex_ = addrIndex; _ldifFile_ = ldif_create(); fsfile = conv_filename_from_utf8( file ); ldif_set_file(_ldifFile_, fsfile); g_free( fsfile ); if( ldif_read_tags( _ldifFile_ ) != MGU_SUCCESS ) goto finish; list = ldif_get_fieldlist( _ldifFile_ ); node = list; while( node ) { Ldif_FieldRec *rec = node->data; if( ! rec->reserved ) { if( g_ascii_strcasecmp( rec->tagName, "dn" ) != 0 ) { rec->selected = TRUE; } } node = g_list_next( node ); } g_list_free( list ); g_free( impldif_dlg.nameBook ); impldif_dlg.nameBook = g_strdup(book_name); ret = imp_ldif_field_move(); g_free( impldif_dlg.nameBook ); impldif_dlg.nameBook = NULL; finish: ldif_free( _ldifFile_ ); _ldifFile_ = NULL; _imp_addressIndex_ = NULL; if (ret) debug_print("addressbook_imp_ldif_file: import succeeded\n"); return _importedBook_; }