[easytag/wip/application-window: 4/70] Move CDDB dialog to EtCDDBDialog object



commit c4de06cf9fee6f26c3c62e1c20d840f5b97f2863
Author: David King <amigadave amigadave com>
Date:   Sun Dec 29 16:41:51 2013 +0000

    Move CDDB dialog to EtCDDBDialog object

 Makefile.am                   |    4 +-
 po/POTFILES.in                |    2 +-
 src/application_window.c      |   49 +
 src/application_window.h      |    3 +
 src/bar.c                     |    9 +-
 src/cddb.h                    |   33 -
 src/{cddb.c => cddb_dialog.c} | 5032 +++++++++++++++++++++--------------------
 src/cddb_dialog.h             |   54 +
 src/easytag.c                 |    3 +-
 src/preferences_dialog.c      |    2 +-
 src/setting.c                 |   20 +-
 src/setting.h                 |    7 -
 12 files changed, 2695 insertions(+), 2523 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 44c2834..699f018 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,7 @@ easytag_SOURCES = \
        src/bar.c \
        src/browser.c \
        src/browser.h \
-       src/cddb.c \
+       src/cddb_dialog.c \
        src/charset.c \
        src/crc32.c \
        src/dlm.c \
@@ -92,7 +92,7 @@ easytag_headers = \
        src/application.h \
        src/application_window.h \
        src/bar.h \
-       src/cddb.h \
+       src/cddb_dialog.h \
        src/charset.h \
        src/crc32.h \
        src/dlm.h \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3a9fe66..b4c92ab 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,7 +7,7 @@ src/application.c
 src/application_window.c
 src/bar.c
 src/browser.c
-src/cddb.c
+src/cddb_dialog.c
 src/charset.c
 src/easytag.c
 src/et_core.c
diff --git a/src/application_window.c b/src/application_window.c
index ec5bbb9..11d21ec 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -25,6 +25,7 @@
 
 #include "bar.h"
 #include "browser.h"
+#include "cddb_dialog.h"
 #include "easytag.h"
 #include "gtk2_compat.h"
 #include "load_files_dialog.h"
@@ -48,6 +49,7 @@ struct _EtApplicationWindowPrivate
     GtkWidget *file_area;
     GtkWidget *log_area;
     GtkWidget *tag_area;
+    GtkWidget *cddb_dialog;
     GtkWidget *load_files_dialog;
     GtkWidget *playlist_dialog;
     GtkWidget *preferences_dialog;
@@ -1645,6 +1647,7 @@ et_application_window_finalize (GObject *object)
 
     priv = et_application_window_get_instance_private (ET_APPLICATION_WINDOW (object));
 
+    g_clear_object (&priv->cddb_dialog);
     g_clear_object (&priv->load_files_dialog);
     g_clear_object (&priv->playlist_dialog);
     g_clear_object (&priv->preferences_dialog);
@@ -1666,6 +1669,7 @@ et_application_window_init (EtApplicationWindow *self)
                                                      ET_TYPE_APPLICATION_WINDOW,
                                                      EtApplicationWindowPrivate);
 
+    priv->cddb_dialog = NULL;
     priv->load_files_dialog = NULL;
     priv->playlist_dialog = NULL;
     priv->preferences_dialog = NULL;
@@ -1944,6 +1948,51 @@ et_application_window_show_preferences_dialog_scanner (G_GNUC_UNUSED GtkAction *
     et_preferences_dialog_show_scanner (ET_PREFERENCES_DIALOG (priv->preferences_dialog));
 }
 
+GtkWidget *
+et_application_window_get_cddb_dialog (EtApplicationWindow *self)
+{
+    EtApplicationWindowPrivate *priv;
+
+    g_return_val_if_fail (self != NULL, NULL);
+
+    priv = et_application_window_get_instance_private (self);
+
+    return priv->cddb_dialog;
+}
+
+void
+et_application_window_show_cddb_dialog (G_GNUC_UNUSED GtkAction *action,
+                                        gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
+
+    priv = et_application_window_get_instance_private (self);
+
+    if (priv->cddb_dialog)
+    {
+        gtk_widget_show (priv->cddb_dialog);
+    }
+    else
+    {
+        priv->cddb_dialog = GTK_WIDGET (et_cddb_dialog_new ());
+        gtk_widget_show_all (priv->cddb_dialog);
+    }
+}
+
+void
+et_application_window_search_cddb_for_selection (G_GNUC_UNUSED GtkAction *action,
+                                                 gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
+
+    priv = et_application_window_get_instance_private (self);
+
+    et_application_window_show_cddb_dialog (action, user_data);
+    et_cddb_dialog_search_from_selection (ET_CDDB_DIALOG (priv->cddb_dialog));
+}
+
 /*
  * Disable (FALSE) / Enable (TRUE) all user widgets in the tag area
  */
diff --git a/src/application_window.h b/src/application_window.h
index eb41a7f..e5b5545 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -60,6 +60,9 @@ void et_application_window_show_search_dialog (GtkAction *action, gpointer user_
 GtkWidget * et_application_window_get_preferences_dialog (EtApplicationWindow *self);
 void et_application_window_show_preferences_dialog (GtkAction *action, gpointer user_data);
 void et_application_window_show_preferences_dialog_scanner (GtkAction *action, gpointer user_data);
+GtkWidget * et_application_window_get_cddb_dialog (EtApplicationWindow *self);
+void et_application_window_show_cddb_dialog (GtkAction *action, gpointer user_data);
+void et_application_window_search_cddb_for_selection (GtkAction *action, gpointer user_data);
 void et_application_window_hide_log_area (EtApplicationWindow *self);
 void et_application_window_show_log_area (EtApplicationWindow *self);
 
diff --git a/src/bar.c b/src/bar.c
index 07bb1ff..af14e09 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -31,7 +31,7 @@
 #include "setting.h"
 #include "browser.h"
 #include "scan_dialog.h"
-#include "cddb.h"
+#include "cddb_dialog.h"
 #include "log.h"
 #include "misc.h"
 #include "charset.h"
@@ -288,7 +288,8 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
           _("Search filenames and tags"),
           G_CALLBACK (et_application_window_show_search_dialog) },
         { AM_CDDB_SEARCH, GTK_STOCK_CDROM, _("CDD_B Search…"), "<Primary>B",
-          _("CDDB search"), G_CALLBACK (Open_Cddb_Window) },
+          _("CDDB search"),
+          G_CALLBACK (et_application_window_show_cddb_dialog) },
         { AM_FILENAME_FROM_TXT, GTK_STOCK_OPEN,
           _("Load Filenames From a Text File…"), "<Primary>T",
           _("Load filenames from a text file"),
@@ -331,7 +332,9 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { POPUP_DIR_RUN_AUDIO,          GTK_STOCK_MEDIA_PLAY,   _("Run Audio Player"),          NULL, _("Run 
audio player"),        G_CALLBACK(Run_Audio_Player_Using_Directory) },
         { AM_ARTIST_RUN_AUDIO_PLAYER,   GTK_STOCK_MEDIA_PLAY,   _("Run Audio Player"),          NULL, _("Run 
audio player"),        G_CALLBACK(Run_Audio_Player_Using_Browser_Artist_List) },
         { AM_ALBUM_RUN_AUDIO_PLAYER,    GTK_STOCK_MEDIA_PLAY,   _("Run Audio Player"),          NULL, _("Run 
audio player"),        G_CALLBACK(Run_Audio_Player_Using_Browser_Album_List)  },
-        { AM_CDDB_SEARCH_FILE,          GTK_STOCK_CDROM,   _("CDDB Search Files…"),    NULL, _("CDDB search 
files…"),  G_CALLBACK(Cddb_Popup_Menu_Search_Selected_File) },
+        { AM_CDDB_SEARCH_FILE, GTK_STOCK_CDROM, _("CDDB Search Files…"), NULL,
+          _("CDDB search files…"),
+          G_CALLBACK (et_application_window_search_cddb_for_selection) },
         //{ AM_ARTIST_OPEN_FILE_WITH,     GTK_STOCK_OPEN,    _("Open File(s) with…"),     NULL, _("Open 
File(s) with…"),     G_CALLBACK(Browser_Open_Run_Program_List_Window??? 
Browser_Open_Run_Program_Tree_Window???) },
         //{ AM_ALBUM_OPEN_FILE_WITH,      GTK_STOCK_OPEN,    _("Open File(s) with…"),     NULL, _("Open 
File(s) with…"),     G_CALLBACK(Browser_Open_Run_Program_List_Window??? 
Browser_Open_Run_Program_Tree_Window???) },
 
diff --git a/src/cddb.c b/src/cddb_dialog.c
similarity index 62%
rename from src/cddb.c
rename to src/cddb_dialog.c
index 19203ce..9f33a21 100644
--- a/src/cddb.c
+++ b/src/cddb_dialog.c
@@ -1,4 +1,3 @@
-/* cddb.c - 2000/09/15 */
 /*
  *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
  *  Copyright (C) 2000-2003  Jerome Couderc <easytag gmail com>
@@ -40,7 +39,7 @@
 #include <errno.h>
 
 #include "gtk2_compat.h"
-#include "cddb.h"
+#include "cddb_dialog.h"
 #include "easytag.h"
 #include "et_core.h"
 #include "browser.h"
@@ -52,6 +51,75 @@
 #include "setting.h"
 #include "charset.h"
 
+/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
+G_DEFINE_TYPE (EtCDDBDialog, et_cddb_dialog, GTK_TYPE_DIALOG)
+
+#define et_cddb_dialog_get_instance_private(dialog) (dialog->priv)
+
+struct _EtCDDBDialogPrivate
+{
+    GtkWidget *album_list_view;
+    GtkWidget *track_list_view;
+
+    GList *album_list;
+
+    GtkListStore *album_list_model;
+    GtkListStore *search_string_model;
+    GtkListStore *search_string_in_result_model;
+    GtkListStore *track_list_model;
+
+    GtkWidget *search_string_entry;
+    GtkWidget *search_string_in_results_entry;
+
+    GtkWidget *search_all_toggle;
+    GtkWidget *search_artist_toggle;
+    GtkWidget *search_title_toggle;
+    GtkWidget *search_track_toggle;
+    GtkWidget *search_other_toggle;
+
+    GtkWidget *categories_all_toggle;
+    GtkWidget *categories_blues_toggle;
+    GtkWidget *categories_classical_toggle;
+    GtkWidget *categories_country_toggle;
+    GtkWidget *categories_folk_toggle;
+    GtkWidget *categories_jazz_toggle;
+    GtkWidget *categories_misc_toggle;
+    GtkWidget *categories_newage_toggle;
+    GtkWidget *categories_reggae_toggle;
+    GtkWidget *categories_rock_toggle;
+    GtkWidget *categories_soundtrack_toggle;
+
+    GtkWidget *set_all_toggle;
+    GtkWidget *set_title_toggle;
+    GtkWidget *set_artist_toggle;
+    GtkWidget *set_album_toggle;
+    GtkWidget *set_year_toggle;
+    GtkWidget *set_tracknumber_toggle;
+    GtkWidget *set_totaltracks_toggle;
+    GtkWidget *set_genre_toggle;
+    GtkWidget *set_filename_toggle;
+
+    GtkWidget *apply_button;
+    GtkWidget *search_button;
+    GtkWidget *stop_search_button;
+    GtkWidget *stop_auto_search_button;
+
+    GtkWidget *display_red_lines_toggle;
+    GtkWidget *show_categories_toggle;
+
+    GtkWidget *status_bar;
+    guint status_bar_context;
+
+    gboolean stop_searching;
+
+    GtkWidget *run_scanner_toggle;
+    GtkWidget *use_dlm2_toggle; /* '2' as also used in prefs.c */
+    GtkWidget *use_local_access_toggle;
+
+    GtkWidget *separator_h;
+    GtkWidget *separator_v;
+};
+
 /*
  * Structure used for each item of the album list. Aslo attached to each row of
  * the album list
@@ -151,1199 +219,349 @@ static const gchar CDDB_RESULT_FILE[] = "cddb_result_file.tmp";
 
 static const guint BOX_SPACING = 6;
 
-/****************
- * Declarations *
- ****************/
-static GtkWidget *CddbWindow;
-static GtkWidget *CddbWindowHPaned;
-
-static GtkWidget *CddbNoteBook;
-static GList *CddbAlbumList = NULL;
-
-static GtkWidget *CddbSearchStringCombo = NULL;
-static GtkListStore *CddbSearchStringModel = NULL;
-
-static GtkWidget *CddbSearchStringInResultCombo;
-static GtkListStore *CddbSearchStringInResultModel = NULL;
-
-static GtkWidget *CddbAlbumListView = NULL;
-static GtkListStore *CddbAlbumListModel = NULL;
-static GtkWidget *CddbTrackListView = NULL;
-static GtkListStore *CddbTrackListModel = NULL;
-static GtkWidget *CddbApplyButton = NULL;
-static GtkWidget *CddbSearchButton = NULL;
-static GtkWidget *CddbSearchAutoButton = NULL;
-static GtkWidget *CddbStatusBar;
-static guint CddbStatusBarContext;
-
-static GtkWidget *CddbStopSearchButton;
-static GtkWidget *CddbStopSearchAutoButton;
-static GtkWidget *CddbSearchStringInResultNextButton;
-static GtkWidget *CddbSearchStringInResultPrevButton;
-static GtkWidget *CddbDisplayRedLinesButton;
-static GtkWidget *CddbSelectAllInResultButton;
-static GtkWidget *CddbUnselectAllInResultButton;
-static GtkWidget *CddbInvertSelectionInResultButton;
-
-static GtkWidget *CddbShowCategoriesButton;
-
-static GtkWidget *CddbSeparatorH;
-static GtkWidget *CddbSeparatorV;
-
-static GtkWidget *CddbSearchInAllFields;
-static GtkWidget *CddbSearchInArtistField;
-static GtkWidget *CddbSearchInTitleField;
-static GtkWidget *CddbSearchInTrackNameField;
-static GtkWidget *CddbSearchInOtherField;
-
-static GtkWidget *CddbSetToAllFields;
-static GtkWidget *CddbSetToTitle;
-static GtkWidget *CddbSetToArtist;
-static GtkWidget *CddbSetToAlbum;
-static GtkWidget *CddbSetToYear;
-static GtkWidget *CddbSetToTrack;
-static GtkWidget *CddbSetToTrackTotal;
-static GtkWidget *CddbSetToGenre;
-static GtkWidget *CddbSetToFileName;
-
-static GtkWidget *CddbRunScanner;
-static GtkWidget *CddbUseDLM2; /* '2' as also used in prefs.c */
-static GtkWidget *CddbUseLocalAccess;
-
-static GtkWidget *CddbSearchInAllCategories;
-static GtkWidget *CddbSearchInBluesCategory;
-static GtkWidget *CddbSearchInClassicalCategory;
-static GtkWidget *CddbSearchInCountryCategory;
-static GtkWidget *CddbSearchInFolkCategory;
-static GtkWidget *CddbSearchInJazzCategory;
-static GtkWidget *CddbSearchInMiscCategory;
-static GtkWidget *CddbSearchInNewageCategory;
-static GtkWidget *CddbSearchInReggaeCategory;
-static GtkWidget *CddbSearchInRockCategory;
-static GtkWidget *CddbSearchInSoundtrackCategory;
-
-static gboolean CddbStopSearch = FALSE;
-
 
 /**************
  * Prototypes *
  **************/
-static gboolean Cddb_Destroy_Window (GtkWidget *widget, GdkEvent *event,
-                                     gpointer data);
-static void Cddb_Show_Album_Info (GtkTreeSelection *selection, gpointer data);
-
-static gboolean Cddb_Free_Album_List (void);
 static gboolean Cddb_Free_Track_Album_List (GList *track_list);
 
-static gint Cddb_Open_Connection (const gchar *host, gint port);
-static void Cddb_Close_Connection (gint socket_id);
 static gint Cddb_Read_Line        (FILE **file, gchar **cddb_out);
 static gint Cddb_Read_Http_Header (FILE **file, gchar **cddb_out);
 static gint Cddb_Read_Cddb_Header (FILE **file, gchar **cddb_out);
 
-static gint Cddb_Write_Result_To_File (gint socket_id,
-                                       gulong *bytes_read_total);
-
-static gboolean Cddb_Search_Album_List_From_String (void);
-static gboolean Cddb_Search_Album_List_From_String_Freedb (void);
-static gboolean Cddb_Search_Album_List_From_String_Gnudb (void);
-static gboolean Cddb_Search_Album_From_Selected_Files (void);
-static gboolean Cddb_Get_Album_Tracks_List_CB (GtkTreeSelection *selection,
-                                               gpointer data);
-static gboolean Cddb_Get_Album_Tracks_List (GtkTreeSelection *selection);
-
-static void Cddb_Load_Album_List (gboolean only_red_lines);
-static void Cddb_Load_Track_Album_List (GList *track_list);
-static gboolean Cddb_Set_Track_Infos_To_File_List (void);
-static void Cddb_Album_List_Set_Row_Appearance (GtkTreeIter *row);
 static GdkPixbuf *Cddb_Get_Pixbuf_From_Server_Name (const gchar *server_name);
 
-static void Cddb_Search_In_All_Fields_Check_Button_Toggled (void);
-static void Cddb_Search_In_All_Categories_Check_Button_Toggled (void);
-static void Cddb_Set_To_All_Fields_Check_Button_Toggled (void);
-static void Cddb_Stop_Search (void);
-static void Cddb_Search_String_In_Result (GtkWidget *entry, GtkButton *button);
-static void Cddb_Display_Red_Lines_In_Result (void);
-
-static void Cddb_Set_Apply_Button_Sensitivity (void);
-static void Cddb_Set_Search_Button_Sensitivity (void);
-static void Cddb_Use_Dlm_2_Check_Button_Toggled (void);
-static void Cddb_Show_Categories_Button_Toggled (void);
-static gchar *Cddb_Generate_Request_String_With_Fields_And_Categories_Options (void);
 static const gchar *Cddb_Get_Id3_Genre_From_Cddb_Genre (const gchar *cddb_genre);
 
-static void Cddb_Track_List_Row_Selected (GtkTreeSelection *selection,
-                                          gpointer data);
-static gboolean Cddb_Track_List_Button_Press (GtkTreeView *treeView,
-                                              GdkEventButton *event);
-
-static void Cddb_Track_List_Select_All (void);
-static void Cddb_Track_List_Unselect_All (void);
-static void Cddb_Track_List_Invert_Selection (void);
-
 static gint Cddb_Track_List_Sort_Func (GtkTreeModel *model, GtkTreeIter *a,
                                        GtkTreeIter *b, gpointer data);
 
 static gchar *Cddb_Format_Proxy_Authentification (void);
 
+static gboolean Cddb_Get_Album_Tracks_List_CB (EtCDDBDialog *self, GtkTreeSelection *selection);
 
 
-/*************
- * Functions *
- *************/
-void Init_CddbWindow (void)
-{
-    CddbWindow = NULL;
-}
-
 /*
  * The window to connect to the cd data base.
  */
 
-void Open_Cddb_Window (void)
-{
-    GtkWidget *VBox, *vbox, *hbox, *notebookvbox;
-    GtkWidget *Frame;
-    GtkWidget *Table;
-    GtkWidget *Label;
-    GtkWidget *Button;
-    GtkWidget *Separator;
-    GtkWidget *ScrollWindow;
-    GtkWidget *Icon;
-    gchar *CddbAlbumList_Titles[] = { NULL, N_("Artist / Album"), N_("Category")}; // Note: don't set "" 
instead of NULL else this will cause problem with translation language
-    gchar *CddbTrackList_Titles[] = { "#", N_("Track Name"), N_("Duration")};
-    GtkCellRenderer* renderer;
-    GtkTreeViewColumn* column;
-    GtkTreePath *path;
-    GtkAllocation allocation = { 0,0,0,0 };
-
-    if (CddbWindow != NULL)
-    {
-        gtk_window_present(GTK_WINDOW(CddbWindow));
-        return;
-    }
-    CddbWindow = gtk_dialog_new ();
-    gtk_window_set_title (GTK_WINDOW (CddbWindow), _("CDDB Search"));
-
-    // This part is needed to set correctly the position of handle panes
-    gtk_window_set_default_size(GTK_WINDOW(CddbWindow),CDDB_WINDOW_WIDTH,CDDB_WINDOW_HEIGHT);
-
-    g_signal_connect(G_OBJECT(CddbWindow),"delete_event", G_CALLBACK(Cddb_Destroy_Window),NULL);
-
-    VBox = gtk_dialog_get_content_area (GTK_DIALOG (CddbWindow));
-    gtk_container_set_border_width (GTK_CONTAINER (CddbWindow), BOX_SPACING);
-
-     /*
-      * Cddb NoteBook
-      */
-    CddbNoteBook = gtk_notebook_new();
-    gtk_notebook_popup_enable(GTK_NOTEBOOK(CddbNoteBook));
-    gtk_box_pack_start(GTK_BOX(VBox),CddbNoteBook,FALSE,FALSE,0);
-
-    /*
-     * 1 - Page for automatic search (generate the CDDBId from files)
-     */
-    Label = gtk_label_new(_("Automatic Search"));
-
-    notebookvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_set_border_width (GTK_CONTAINER (notebookvbox), BOX_SPACING);
-    gtk_notebook_append_page (GTK_NOTEBOOK (CddbNoteBook), notebookvbox,
-                              Label);
-
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
-    gtk_box_pack_start(GTK_BOX(notebookvbox),hbox,FALSE,FALSE,0);
-
-    Label = gtk_label_new(_("Request CDDB"));
-    gtk_misc_set_alignment(GTK_MISC(Label),1.0,0.5);
-    gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,0);
-
-    // Button to generate CddbId and request string from the selected files
-    CddbSearchAutoButton = gtk_button_new_from_stock(GTK_STOCK_FIND);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSearchAutoButton,FALSE,FALSE,0);
-    gtk_widget_set_can_default(CddbSearchAutoButton,TRUE);
-    gtk_widget_grab_default(CddbSearchAutoButton);
-    
g_signal_connect(G_OBJECT(CddbSearchAutoButton),"clicked",G_CALLBACK(Cddb_Search_Album_From_Selected_Files),NULL);
-    gtk_widget_set_tooltip_text(CddbSearchAutoButton,_("Request automatically the "
-        "CDDB using the selected files (the order is important) to "
-        "generate the CddbID"));
-
-    // Button to stop the search
-    CddbStopSearchAutoButton = Create_Button_With_Icon_And_Label(GTK_STOCK_STOP,NULL);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbStopSearchAutoButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbStopSearchAutoButton),GTK_RELIEF_NONE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
-    g_signal_connect(G_OBJECT(CddbStopSearchAutoButton), "clicked", G_CALLBACK(Cddb_Stop_Search), NULL);
-    gtk_widget_set_tooltip_text (CddbStopSearchAutoButton,
-                                 _("Stop the search"));
-
-    // Separator line
-    Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-    gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
-
-    // Check box to run the scanner
-    CddbUseLocalAccess = gtk_check_button_new_with_label(_("Use local CDDB"));
-    gtk_box_pack_start(GTK_BOX(hbox),CddbUseLocalAccess,FALSE,FALSE,0);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbUseLocalAccess),CDDB_USE_LOCAL_ACCESS);
-    gtk_widget_set_tooltip_text(CddbUseLocalAccess,_("When activating this option, after loading the "
-        "fields, the current selected scanner will be ran (the scanner window must be opened)."));
-
-    // Separator line
-    Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-    gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
-
-    // Button to quit
-    Button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-    gtk_box_pack_end(GTK_BOX(hbox),Button,FALSE,FALSE,0);
-    gtk_widget_set_can_default(Button,TRUE);
-    g_signal_connect(G_OBJECT(Button),"clicked", G_CALLBACK(Cddb_Destroy_Window),NULL);
-
-
-    /*
-     * 2 - Page for manual search
-     */
-    Label = gtk_label_new(_("Manual Search"));
-    notebookvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_notebook_append_page (GTK_NOTEBOOK (CddbNoteBook), notebookvbox,
-                              Label);
-    gtk_container_set_border_width (GTK_CONTAINER (notebookvbox), BOX_SPACING);
-
-    /*
-     * Words to search
-     */
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
-    gtk_box_pack_start(GTK_BOX(notebookvbox),hbox,FALSE,FALSE,0);
-
-    Label = gtk_label_new(_("Words:"));
-    gtk_misc_set_alignment(GTK_MISC(Label),1.0,0.5);
-    gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,0);
-
-    g_assert (CddbSearchStringModel == NULL);
-    CddbSearchStringModel = gtk_list_store_new (MISC_COMBO_COUNT,
-                                                G_TYPE_STRING);
-
-    CddbSearchStringCombo = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(CddbSearchStringModel));
-    g_object_unref (CddbSearchStringModel);
-    gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(CddbSearchStringCombo),MISC_COMBO_TEXT);
-    gtk_widget_set_size_request(GTK_WIDGET(CddbSearchStringCombo),220,-1);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSearchStringCombo,FALSE,TRUE,0);
-    
gtk_widget_set_tooltip_text(GTK_WIDGET(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))),_("Enter 
the words to "
-        "search (separated by a space or '+')"));
-    // History List
-    Load_Cddb_Search_String_List(CddbSearchStringModel, MISC_COMBO_TEXT);
-
-    g_signal_connect(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))),"activate",
-        G_CALLBACK(Cddb_Search_Album_List_From_String),NULL);
-    gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo))),"");
-
-    // Set content of the clipboard if available
-    gtk_editable_paste_clipboard(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo))));
-
-    // Button to run the search
-    CddbSearchButton = gtk_button_new_from_stock(GTK_STOCK_FIND);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSearchButton,FALSE,FALSE,0);
-    gtk_widget_set_can_default(CddbSearchButton,TRUE);
-    gtk_widget_grab_default(CddbSearchButton);
-    g_signal_connect(G_OBJECT(CddbSearchButton),"clicked",
-        G_CALLBACK(Cddb_Search_Album_List_From_String),NULL);
-    g_signal_connect(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))),"changed",
-        G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-
-    // Button to stop the search
-    CddbStopSearchButton = Create_Button_With_Icon_And_Label(GTK_STOCK_STOP,NULL);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbStopSearchButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbStopSearchButton),GTK_RELIEF_NONE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-    g_signal_connect(G_OBJECT(CddbStopSearchButton), "clicked", G_CALLBACK(Cddb_Stop_Search), NULL);
-    gtk_widget_set_tooltip_text (CddbStopSearchButton, _("Stop the search"));
-
-    // Button to quit
-    Button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-    gtk_box_pack_end(GTK_BOX(hbox),Button,FALSE,FALSE,0);
-    gtk_widget_set_can_default(Button,TRUE);
-    g_signal_connect(G_OBJECT(Button),"clicked", G_CALLBACK(Cddb_Destroy_Window),NULL);
-
-
-    /*
-     * Search options
-     */
-    Frame = gtk_frame_new(_("Search In:"));
-    gtk_box_pack_start(GTK_BOX(notebookvbox),Frame,FALSE,TRUE,0);
-
-    Table = et_grid_new (7,4);
-    gtk_container_add(GTK_CONTAINER(Frame),Table);
-    gtk_grid_set_row_spacing (GTK_GRID (Table), 1);
-    gtk_grid_set_column_spacing (GTK_GRID (Table), 1);
-
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "All fields". */
-    CddbSearchInAllFields      = gtk_check_button_new_with_label(_("All Fields"));
-    Separator                  = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Artist". */
-    CddbSearchInArtistField    = gtk_check_button_new_with_label(_("Artist"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Album". */
-    CddbSearchInTitleField     = gtk_check_button_new_with_label(_("Album"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Track Name". */
-    CddbSearchInTrackNameField = gtk_check_button_new_with_label(_("Track Name"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Other". */
-    CddbSearchInOtherField     = gtk_check_button_new_with_label(_("Other"));
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInAllFields, 0, 0, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), Separator, 1, 0, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInArtistField, 2, 0, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInTitleField, 3, 0, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInTrackNameField, 4, 0, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInOtherField, 5, 0, 1, 1);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields), CDDB_SEARCH_IN_ALL_FIELDS);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInArtistField), CDDB_SEARCH_IN_ARTIST_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInTitleField), CDDB_SEARCH_IN_TITLE_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInTrackNameField), 
CDDB_SEARCH_IN_TRACK_NAME_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInOtherField), CDDB_SEARCH_IN_OTHER_FIELD);
-    g_signal_connect(G_OBJECT(CddbSearchInAllFields), "toggled", 
G_CALLBACK(Cddb_Search_In_All_Fields_Check_Button_Toggled),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInAllFields), "toggled", 
G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInArtistField), "toggled", 
G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInTitleField), "toggled", 
G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInTrackNameField), "toggled", 
G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInOtherField), "toggled", 
G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-
-    CddbSeparatorH = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
-    gtk_grid_attach (GTK_GRID (Table), CddbSeparatorH, 0, 1, 6, 1);
-
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "All Categories". */
-    CddbSearchInAllCategories      = gtk_check_button_new_with_label(_("All Categories"));
-    CddbSeparatorV                 = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Blues". */
-    CddbSearchInBluesCategory      = gtk_check_button_new_with_label(_("Blues"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Classical". */
-    CddbSearchInClassicalCategory  = gtk_check_button_new_with_label(_("Classical"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Country". */
-    CddbSearchInCountryCategory    = gtk_check_button_new_with_label(_("Country"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Folk". */
-    CddbSearchInFolkCategory       = gtk_check_button_new_with_label(_("Folk"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Jazz". */
-    CddbSearchInJazzCategory       = gtk_check_button_new_with_label(_("Jazz"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Misc". */
-    CddbSearchInMiscCategory       = gtk_check_button_new_with_label(_("Misc."));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "New age". */
-    CddbSearchInNewageCategory     = gtk_check_button_new_with_label(_("New Age"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Reggae". */
-    CddbSearchInReggaeCategory     = gtk_check_button_new_with_label(_("Reggae"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Rock". */
-    CddbSearchInRockCategory       = gtk_check_button_new_with_label(_("Rock"));
-    /* Translators: This option is for the previous 'search in' option. For
-     * instance, translate this as "Search in:" "Soundtrack". */
-    CddbSearchInSoundtrackCategory = gtk_check_button_new_with_label(_("Soundtrack"));
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInAllCategories, 0, 2, 1, 2);
-    gtk_grid_attach (GTK_GRID (Table), CddbSeparatorV, 1, 2, 1, 2);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInBluesCategory, 2, 2, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInClassicalCategory, 3, 2, 1,
-                     1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInCountryCategory, 4, 2, 1,
-                     1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInFolkCategory, 5, 2, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInJazzCategory, 6, 2, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInMiscCategory, 2, 3, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInNewageCategory, 3, 3, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInReggaeCategory, 4, 3, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInRockCategory, 5, 3, 1, 1);
-    gtk_grid_attach (GTK_GRID (Table), CddbSearchInSoundtrackCategory, 6, 3, 1,
-                     1);
-    gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(CddbSearchInAllCategories))),TRUE); // Wrap 
label of the check button.
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories),     
CDDB_SEARCH_IN_ALL_CATEGORIES);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInBluesCategory),     
CDDB_SEARCH_IN_BLUES_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInClassicalCategory), 
CDDB_SEARCH_IN_CLASSICAL_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInCountryCategory),   
CDDB_SEARCH_IN_COUNTRY_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInFolkCategory),      
CDDB_SEARCH_IN_FOLK_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInJazzCategory),      
CDDB_SEARCH_IN_JAZZ_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInMiscCategory),      
CDDB_SEARCH_IN_MISC_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInNewageCategory),    
CDDB_SEARCH_IN_NEWAGE_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInReggaeCategory),    
CDDB_SEARCH_IN_REGGAE_CATEGORY);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInRockCategory),      
CDDB_SEARCH_IN_ROCK_CATEGORY);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSearchInSoundtrackCategory),CDDB_SEARCH_IN_SOUNDTRACK_CATEGORY);
-    g_signal_connect(G_OBJECT(CddbSearchInAllCategories),     
"toggled",G_CALLBACK(Cddb_Search_In_All_Categories_Check_Button_Toggled),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInAllCategories),     
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInBluesCategory),     
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInClassicalCategory), 
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInCountryCategory),   
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInFolkCategory),      
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInJazzCategory),      
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInMiscCategory),      
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInNewageCategory),    
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInReggaeCategory),    
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSearchInRockCategory),      
"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    
g_signal_connect(G_OBJECT(CddbSearchInSoundtrackCategory),"toggled",G_CALLBACK(Cddb_Set_Search_Button_Sensitivity),NULL);
-    gtk_widget_set_tooltip_text(CddbSearchInRockCategory,_("included: funk, soul, rap, pop, industrial, 
metal, etc."));
-    gtk_widget_set_tooltip_text(CddbSearchInSoundtrackCategory,_("movies, shows"));
-    gtk_widget_set_tooltip_text(CddbSearchInMiscCategory,_("others that do not fit in the above 
categories"));
-
-    // Button to display/hide the categories
-    CddbShowCategoriesButton = gtk_toggle_button_new_with_label(_("Categories"));
-    gtk_grid_attach (GTK_GRID (Table), CddbShowCategoriesButton, 6, 0, 1, 1);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbShowCategoriesButton),CDDB_SHOW_CATEGORIES);
-    g_signal_connect(G_OBJECT(CddbShowCategoriesButton),"toggled", 
G_CALLBACK(Cddb_Show_Categories_Button_Toggled),NULL);
-
-    /*
-     * Results command
-     */
-    Frame = gtk_frame_new(_("Results:"));
-    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,TRUE,0);
-
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),hbox);
-
-    Label = gtk_label_new(_("Search:"));
-    gtk_misc_set_alignment(GTK_MISC(Label),1.0,0.5);
-    gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,0);
-
-    g_assert (CddbSearchStringInResultModel == NULL);
-    CddbSearchStringInResultModel = gtk_list_store_new (MISC_COMBO_COUNT,
-                                                        G_TYPE_STRING);
-
-    CddbSearchStringInResultCombo = 
gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(CddbSearchStringInResultModel));
-    g_object_unref (CddbSearchStringInResultModel);
-    gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(CddbSearchStringInResultCombo),MISC_COMBO_TEXT);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSearchStringInResultCombo,FALSE,FALSE,0);
-    
g_signal_connect_swapped(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringInResultCombo)))),"activate",
-                             G_CALLBACK(Cddb_Search_String_In_Result), 
G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringInResultCombo)))));
-    
gtk_widget_set_tooltip_text(GTK_WIDGET(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringInResultCombo)))),_("Enter
 the words to "
-        "search in the list below"));
-
-    // History List
-    Load_Cddb_Search_String_In_Result_List(CddbSearchStringInResultModel, MISC_COMBO_TEXT);
-
-    gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringInResultCombo))),"");
-
-    CddbSearchStringInResultNextButton = Create_Button_With_Icon_And_Label(GTK_STOCK_GO_DOWN,NULL);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSearchStringInResultNextButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbSearchStringInResultNextButton),GTK_RELIEF_NONE);
-    g_signal_connect_swapped(G_OBJECT(CddbSearchStringInResultNextButton),"clicked", 
G_CALLBACK(Cddb_Search_String_In_Result), 
G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringInResultCombo)))));
-    gtk_widget_set_tooltip_text(CddbSearchStringInResultNextButton,_("Search Next"));
-
-    CddbSearchStringInResultPrevButton = Create_Button_With_Icon_And_Label(GTK_STOCK_GO_UP,NULL);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSearchStringInResultPrevButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbSearchStringInResultPrevButton),GTK_RELIEF_NONE);
-    g_signal_connect_swapped(G_OBJECT(CddbSearchStringInResultPrevButton),"clicked", 
G_CALLBACK(Cddb_Search_String_In_Result), 
G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringInResultCombo)))));
-    gtk_widget_set_tooltip_text(CddbSearchStringInResultPrevButton,_("Search Previous"));
-
-    // Separator line
-    Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-    gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
-
-    CddbDisplayRedLinesButton = gtk_toggle_button_new();
-    Icon = gtk_image_new_from_stock("easytag-red-lines", GTK_ICON_SIZE_BUTTON);
-    gtk_container_add(GTK_CONTAINER(CddbDisplayRedLinesButton),Icon);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbDisplayRedLinesButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbDisplayRedLinesButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(CddbDisplayRedLinesButton,_("Show only red lines (or show all lines) in the 
'Artist / Album' list"));
-    
g_signal_connect(G_OBJECT(CddbDisplayRedLinesButton),"toggled",G_CALLBACK(Cddb_Display_Red_Lines_In_Result),NULL);
-
-    CddbUnselectAllInResultButton = Create_Button_With_Icon_And_Label("easytag-unselect-all",NULL);
-    gtk_box_pack_end(GTK_BOX(hbox),CddbUnselectAllInResultButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbUnselectAllInResultButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(CddbUnselectAllInResultButton,_("Unselect all lines"));
-    
g_signal_connect(G_OBJECT(CddbUnselectAllInResultButton),"clicked",G_CALLBACK(Cddb_Track_List_Unselect_All),NULL);
-
-    CddbInvertSelectionInResultButton = Create_Button_With_Icon_And_Label("easytag-invert-selection",NULL);
-    gtk_box_pack_end(GTK_BOX(hbox),CddbInvertSelectionInResultButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbInvertSelectionInResultButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(CddbInvertSelectionInResultButton,_("Invert lines selection"));
-    
g_signal_connect(G_OBJECT(CddbInvertSelectionInResultButton),"clicked",G_CALLBACK(Cddb_Track_List_Invert_Selection),NULL);
-
-    CddbSelectAllInResultButton = gtk_button_new ();
-    gtk_container_add (GTK_CONTAINER (CddbSelectAllInResultButton),
-                       gtk_image_new_from_stock (GTK_STOCK_SELECT_ALL,
-                                                 GTK_ICON_SIZE_BUTTON));
-    gtk_box_pack_end(GTK_BOX(hbox),CddbSelectAllInResultButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(CddbSelectAllInResultButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(CddbSelectAllInResultButton,_("Select all lines"));
-    
g_signal_connect(G_OBJECT(CddbSelectAllInResultButton),"clicked",G_CALLBACK(Cddb_Track_List_Select_All),NULL);
-
-    /*
-     * Result of search
-     */
-    CddbWindowHPaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
-    gtk_box_pack_start(GTK_BOX(VBox),CddbWindowHPaned,TRUE,TRUE,0);
-    gtk_paned_set_position(GTK_PANED(CddbWindowHPaned),CDDB_PANE_HANDLE_POSITION);
-
-    // List of albums
-    ScrollWindow = gtk_scrolled_window_new(NULL, NULL);
-    
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindow),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
-    gtk_widget_set_size_request(GTK_WIDGET(ScrollWindow),-1,100);
-    gtk_paned_pack1(GTK_PANED(CddbWindowHPaned),ScrollWindow,TRUE,FALSE);
-
-    CddbAlbumListModel = gtk_list_store_new(CDDB_ALBUM_LIST_COUNT,
-                                            GDK_TYPE_PIXBUF,
-                                            G_TYPE_STRING,
-                                            G_TYPE_STRING,
-                                            G_TYPE_POINTER,
-                                            PANGO_TYPE_STYLE,
-                                            G_TYPE_INT,
-                                            GDK_TYPE_RGBA);
-    CddbAlbumListView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(CddbAlbumListModel));
-    g_object_unref (CddbAlbumListModel);
-
-    renderer = gtk_cell_renderer_pixbuf_new();
-    column = gtk_tree_view_column_new_with_attributes(_(CddbAlbumList_Titles[0]), renderer,
-                                                      "pixbuf",         CDDB_ALBUM_LIST_PIXBUF,
-                                                      NULL);
-    gtk_tree_view_column_set_resizable(column, FALSE);
-    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(CddbAlbumListView), column);
-
-    renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes(_(CddbAlbumList_Titles[1]), renderer,
-                                                      "text",           CDDB_ALBUM_LIST_ALBUM,
-                                                      "weight",         CDDB_ALBUM_LIST_FONT_WEIGHT,
-                                                      "style",          CDDB_ALBUM_LIST_FONT_STYLE,
-                                                      "foreground-rgba", CDDB_ALBUM_LIST_FOREGROUND_COLOR,
-                                                      NULL);
-    gtk_tree_view_column_set_resizable(column, TRUE);
-    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(CddbAlbumListView), column);
-
-    renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes(_(CddbAlbumList_Titles[2]), renderer,
-                                                      "text",           CDDB_ALBUM_LIST_CATEGORY,
-                                                      "weight",         CDDB_ALBUM_LIST_FONT_WEIGHT,
-                                                      "style",          CDDB_ALBUM_LIST_FONT_STYLE,
-                                                      "foreground-rgba", CDDB_ALBUM_LIST_FOREGROUND_COLOR,
-                                                      NULL);
-    gtk_tree_view_column_set_resizable(column, TRUE);
-    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(CddbAlbumListView), column);
-    //gtk_tree_view_columns_autosize(GTK_TREE_VIEW(CddbAlbumListView));
-
-    gtk_container_add(GTK_CONTAINER(ScrollWindow), CddbAlbumListView);
-
-    path = gtk_tree_path_new_first ();
-    gtk_tree_view_set_cursor (GTK_TREE_VIEW (CddbAlbumListView), path, NULL,
-                              FALSE);
-    gtk_tree_path_free (path);
-    g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView))),
-            "changed", G_CALLBACK(Cddb_Show_Album_Info), NULL);
-    g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView))),
-            "changed", G_CALLBACK(Cddb_Get_Album_Tracks_List_CB), NULL);
-
-    // List of tracks
-    ScrollWindow = gtk_scrolled_window_new(NULL,NULL);
-    
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindow),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
-
-
-    gtk_widget_set_size_request(GTK_WIDGET(ScrollWindow), -1, 100);
-    gtk_paned_pack2(GTK_PANED(CddbWindowHPaned), ScrollWindow, TRUE, FALSE);
-
-    CddbTrackListModel = gtk_list_store_new(CDDB_TRACK_LIST_COUNT,
-                                            G_TYPE_UINT,
-                                            G_TYPE_STRING,
-                                            G_TYPE_STRING,
-                                            G_TYPE_POINTER,
-                                            G_TYPE_POINTER);
-    CddbTrackListView = gtk_tree_view_new_with_model(GTK_TREE_MODEL(CddbTrackListModel));
-    g_object_unref (CddbTrackListModel);
-    renderer = gtk_cell_renderer_text_new();
-    g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); // Align to the right
-    column = gtk_tree_view_column_new_with_attributes(_(CddbTrackList_Titles[0]), renderer,
-                                                      "text", CDDB_TRACK_LIST_NUMBER, NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(CddbTrackListView), column);
-    gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(CddbTrackListModel), SORT_LIST_NUMBER,
-                                    Cddb_Track_List_Sort_Func, GINT_TO_POINTER(SORT_LIST_NUMBER), NULL);
-    gtk_tree_view_column_set_sort_column_id(column, SORT_LIST_NUMBER);
-    renderer = gtk_cell_renderer_text_new();
-    column = gtk_tree_view_column_new_with_attributes(_(CddbTrackList_Titles[1]), renderer,
-                                                      "text", CDDB_TRACK_LIST_NAME, NULL);
-    gtk_tree_view_column_set_resizable(column, TRUE);
-    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(CddbTrackListView), column);
-    gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(CddbTrackListModel), SORT_LIST_NAME,
-                                    Cddb_Track_List_Sort_Func, GINT_TO_POINTER(SORT_LIST_NAME), NULL);
-    gtk_tree_view_column_set_sort_column_id(column, SORT_LIST_NAME);
-
-    renderer = gtk_cell_renderer_text_new();
-    g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); // Align to the right
-    column = gtk_tree_view_column_new_with_attributes(_(CddbTrackList_Titles[2]), renderer,
-                                                      "text", CDDB_TRACK_LIST_TIME, NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(CddbTrackListView), column);
-
-    //gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(CddbTrackListModel), SORT_LIST_NUMBER, 
GTK_SORT_ASCENDING);
-    gtk_tree_view_set_reorderable(GTK_TREE_VIEW(CddbTrackListView), TRUE);
-
-    gtk_container_add(GTK_CONTAINER(ScrollWindow),CddbTrackListView);
-    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView)),
-                                GTK_SELECTION_MULTIPLE);
-    g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView))),
-                     "changed", G_CALLBACK(Cddb_Track_List_Row_Selected), NULL);
-    g_signal_connect(G_OBJECT(CddbTrackListView),"button_press_event", 
G_CALLBACK(Cddb_Track_List_Button_Press),NULL);
-    gtk_widget_set_tooltip_text(CddbTrackListView, _("Select lines to 'apply' to "
-        "your files list. All lines will be processed if no line is selected.\n"
-        "You can also reorder lines in this list before using 'apply' button."));
-
-    /*
-     * Apply results to fields...
-     */
-    Frame = gtk_frame_new(_("Set Into:"));
-    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,TRUE,0);
-
-    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(Frame),vbox);
-
-    CddbSetToAllFields  = gtk_check_button_new_with_label(_("All"));
-    Separator           = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
-    CddbSetToFileName   = gtk_check_button_new_with_label(_("Filename"));
-    CddbSetToTitle      = gtk_check_button_new_with_label(_("Title"));
-    CddbSetToArtist     = gtk_check_button_new_with_label(_("Artist"));
-    CddbSetToAlbum      = gtk_check_button_new_with_label(_("Album"));
-    CddbSetToYear       = gtk_check_button_new_with_label(_("Year"));
-    CddbSetToTrack      = gtk_check_button_new_with_label(_("Track #"));
-    CddbSetToTrackTotal = gtk_check_button_new_with_label(_("# Tracks"));
-    CddbSetToGenre      = gtk_check_button_new_with_label(_("Genre"));
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
-    gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToAllFields, FALSE,FALSE,0);
-    gtk_box_pack_start(GTK_BOX(hbox),Separator,          FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToFileName,  FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToTitle,     FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToArtist,    FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToAlbum,     FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToYear,      FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToTrack,     FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToTrackTotal,FALSE,FALSE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),CddbSetToGenre,     FALSE,FALSE,2);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields), CDDB_SET_TO_ALL_FIELDS);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToTitle),     CDDB_SET_TO_TITLE);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToArtist),    CDDB_SET_TO_ARTIST);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToAlbum),     CDDB_SET_TO_ALBUM);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToYear),      CDDB_SET_TO_YEAR);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToTrack),     CDDB_SET_TO_TRACK);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToTrackTotal),CDDB_SET_TO_TRACK_TOTAL);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToGenre),     CDDB_SET_TO_GENRE);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbSetToFileName),  CDDB_SET_TO_FILE_NAME);
-    g_signal_connect(G_OBJECT(CddbSetToAllFields), 
"toggled",G_CALLBACK(Cddb_Set_To_All_Fields_Check_Button_Toggled),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToAllFields), 
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToTitle),     
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToArtist),    
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToAlbum),     
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToYear),      
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToTrack),     
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    
g_signal_connect(G_OBJECT(CddbSetToTrackTotal),"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToGenre),     
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-    g_signal_connect(G_OBJECT(CddbSetToFileName),  
"toggled",G_CALLBACK(Cddb_Set_Apply_Button_Sensitivity),NULL);
-
-    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
-    gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
-
-    // Check box to run the scanner
-    CddbRunScanner = gtk_check_button_new_with_label(_("Run the current scanner for each file"));
-    gtk_box_pack_start(GTK_BOX(hbox),CddbRunScanner,FALSE,TRUE,0);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbRunScanner),CDDB_RUN_SCANNER);
-    gtk_widget_set_tooltip_text(CddbRunScanner,_("When activating this option, after loading the "
-        "fields, the current selected scanner will be ran (the scanner window must be opened)."));
-
-    // Check box to use DLM (also used in the preferences window)
-    CddbUseDLM2 = gtk_check_button_new_with_label(_("Match lines with the Levenshtein algorithm"));
-    gtk_box_pack_start(GTK_BOX(hbox),CddbUseDLM2,FALSE,FALSE,0);
-    // Doesn't activate it by default because if the new user don't pay attention to it,
-    // it will not understand why the cddb results aren't loaded correctly...
-    //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbUseDLM2),CDDB_USE_DLM);
-    gtk_widget_set_tooltip_text(CddbUseDLM2,_("When activating this option, the "
-        "Levenshtein algorithm (DLM: Damerau-Levenshtein Metric) will be used "
-        "to match the CDDB title against every filename in the current folder, "
-        "and to select the best match. This will be used when selecting the "
-        "corresponding audio file, or applying CDDB results, instead of using "
-        "directly the position order."));
-    g_signal_connect(G_OBJECT(CddbUseDLM2),"toggled",G_CALLBACK(Cddb_Use_Dlm_2_Check_Button_Toggled),NULL);
-
-    // Button to apply
-    CddbApplyButton = gtk_button_new_from_stock(GTK_STOCK_APPLY);
-    gtk_box_pack_end(GTK_BOX(hbox),CddbApplyButton,FALSE,FALSE,0);
-    g_signal_connect(G_OBJECT(CddbApplyButton),"clicked", 
G_CALLBACK(Cddb_Set_Track_Infos_To_File_List),NULL);
-    gtk_widget_set_tooltip_text(CddbApplyButton,_("Load the selected lines or all lines (if no line 
selected)."));
-
-    /*
-     * Status bar
-     */
-    CddbStatusBar = gtk_statusbar_new();
-    gtk_box_pack_start(GTK_BOX(VBox),CddbStatusBar,FALSE,TRUE,0);
-    gtk_widget_set_size_request(CddbStatusBar, 300, -1);
-    CddbStatusBarContext = gtk_statusbar_get_context_id(GTK_STATUSBAR(CddbStatusBar),"Messages");
-    gtk_statusbar_push (GTK_STATUSBAR (CddbStatusBar), CddbStatusBarContext,
-                        _("Ready to search"));
-
-
-    g_signal_emit_by_name(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))),"changed");
-    g_signal_emit_by_name(G_OBJECT(CddbSearchInAllFields),"toggled");
-    g_signal_emit_by_name(G_OBJECT(CddbSearchInAllCategories),"toggled");
-    g_signal_emit_by_name(G_OBJECT(CddbSetToAllFields),"toggled");
-    CddbStopSearch = FALSE;
-
-    gtk_widget_show_all(CddbWindow);
-    if (SET_CDDB_WINDOW_POSITION
-    && CDDB_WINDOW_X > 0 && CDDB_WINDOW_Y > 0)
-    {
-        gtk_window_move(GTK_WINDOW(CddbWindow),CDDB_WINDOW_X,CDDB_WINDOW_Y);
-    }
-    // Force resize window
-    gtk_widget_get_allocation(GTK_WIDGET(CddbSearchInAllCategories), &allocation);
-    gtk_widget_set_size_request(GTK_WIDGET(CddbSearchInAllFields), allocation.width, -1);
-    g_signal_emit_by_name(G_OBJECT(CddbShowCategoriesButton),"toggled");
-}
-
-static gboolean
-Cddb_Destroy_Window (GtkWidget *widget, GdkEvent *event, gpointer data)
-{
-
-    CddbStopSearch = TRUE;
-    if (CddbWindow)
-    {
-        Cddb_Window_Apply_Changes();
-
-        if (CddbAlbumList)
-        {
-            Cddb_Free_Album_List ();
-            CddbAlbumList = NULL;
-        }
-
-        gtk_widget_destroy(CddbWindow);
-        CddbWindow            = NULL;
-        CddbSearchStringCombo = NULL;
-        CddbSearchStringModel = NULL;
-        CddbSearchStringInResultModel = NULL;
-        CddbAlbumListView     = NULL;
-        CddbAlbumListModel    = NULL;
-        CddbTrackListView     = NULL;
-        CddbTrackListModel    = NULL;
-        CddbApplyButton       = NULL;
-        CddbSearchButton      = NULL;
-        CddbSearchAutoButton  = NULL;
-    }
-    return FALSE;
-}
-
-/*
- * For the configuration file...
- */
-void Cddb_Window_Apply_Changes (void)
-{
-    if (CddbWindow)
-    {
-        gint x, y, width, height;
-        GdkWindow *window;
-
-        window = gtk_widget_get_window(CddbWindow);
-
-        if ( window && gdk_window_is_visible(window) && 
gdk_window_get_state(window)!=GDK_WINDOW_STATE_MAXIMIZED )
-        {
-            // Position and Origin of the window
-            gdk_window_get_root_origin(window,&x,&y);
-            CDDB_WINDOW_X = x;
-            CDDB_WINDOW_Y = y;
-            width = gdk_window_get_width(window);
-            height = gdk_window_get_height(window);
-            CDDB_WINDOW_WIDTH  = width;
-            CDDB_WINDOW_HEIGHT = height;
-
-            // Handle panes position
-            CDDB_PANE_HANDLE_POSITION = gtk_paned_get_position(GTK_PANED(CddbWindowHPaned));
-        }
-
-        CDDB_SEARCH_IN_ALL_FIELDS       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields));
-        CDDB_SEARCH_IN_ARTIST_FIELD     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInArtistField));
-        CDDB_SEARCH_IN_TITLE_FIELD      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInTitleField));
-        CDDB_SEARCH_IN_TRACK_NAME_FIELD = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInTrackNameField));
-        CDDB_SEARCH_IN_OTHER_FIELD      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInOtherField));
-        CDDB_SHOW_CATEGORIES            = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbShowCategoriesButton));
-
-        CDDB_SEARCH_IN_ALL_CATEGORIES      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories));
-        CDDB_SEARCH_IN_BLUES_CATEGORY      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInBluesCategory));
-        CDDB_SEARCH_IN_CLASSICAL_CATEGORY  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInClassicalCategory));
-        CDDB_SEARCH_IN_COUNTRY_CATEGORY    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInCountryCategory));
-        CDDB_SEARCH_IN_FOLK_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInFolkCategory));
-        CDDB_SEARCH_IN_JAZZ_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInJazzCategory));
-        CDDB_SEARCH_IN_MISC_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInMiscCategory));
-        CDDB_SEARCH_IN_NEWAGE_CATEGORY     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInNewageCategory));
-        CDDB_SEARCH_IN_REGGAE_CATEGORY     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInReggaeCategory));
-        CDDB_SEARCH_IN_ROCK_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInRockCategory));
-        CDDB_SEARCH_IN_SOUNDTRACK_CATEGORY = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInSoundtrackCategory));
-
-        CDDB_SET_TO_ALL_FIELDS  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields));
-        CDDB_SET_TO_TITLE       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTitle));
-        CDDB_SET_TO_ARTIST      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToArtist));
-        CDDB_SET_TO_ALBUM       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAlbum));
-        CDDB_SET_TO_YEAR        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToYear));
-        CDDB_SET_TO_TRACK       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTrack));
-        CDDB_SET_TO_TRACK_TOTAL = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTrackTotal));
-        CDDB_SET_TO_GENRE       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToGenre));
-        CDDB_SET_TO_FILE_NAME   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToFileName));
-
-        CDDB_RUN_SCANNER        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbRunScanner));
-        CDDB_USE_DLM            = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseDLM2));
-        CDDB_USE_LOCAL_ACCESS   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseLocalAccess));
-
-        // Save combobox history lists before exit
-        Save_Cddb_Search_String_List(CddbSearchStringModel, MISC_COMBO_TEXT);
-        Save_Cddb_Search_String_In_Result_List(CddbSearchStringInResultModel, MISC_COMBO_TEXT);
-    }
-}
-
-
 static void
-Cddb_Search_In_All_Fields_Check_Button_Toggled (void)
+on_show_categories_toggle_toggled (EtCDDBDialog *self)
 {
-    if (CddbSearchInAllFields)
-    {
-        gtk_widget_set_sensitive(CddbSearchInArtistField,   
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields)));
-        gtk_widget_set_sensitive(CddbSearchInTitleField,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields)));
-        
gtk_widget_set_sensitive(CddbSearchInTrackNameField,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields)));
-        gtk_widget_set_sensitive(CddbSearchInOtherField,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields)));
-    }
-}
+    EtCDDBDialogPrivate *priv;
 
-static void
-Cddb_Show_Categories_Button_Toggled (void)
-{
-    if (CddbShowCategoriesButton)
-    {
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbShowCategoriesButton)))
-        {
-            gtk_widget_show(CddbSeparatorH);
-            gtk_widget_show(CddbSearchInAllCategories);
-            gtk_widget_show(CddbSeparatorV);
-            gtk_widget_show(CddbSearchInBluesCategory);
-            gtk_widget_show(CddbSearchInClassicalCategory);
-            gtk_widget_show(CddbSearchInCountryCategory);
-            gtk_widget_show(CddbSearchInFolkCategory);
-            gtk_widget_show(CddbSearchInJazzCategory);
-            gtk_widget_show(CddbSearchInMiscCategory);
-            gtk_widget_show(CddbSearchInNewageCategory);
-            gtk_widget_show(CddbSearchInReggaeCategory);
-            gtk_widget_show(CddbSearchInRockCategory);
-            gtk_widget_show(CddbSearchInSoundtrackCategory);
-        }else
-        {
-            gtk_widget_hide(CddbSeparatorH);
-            gtk_widget_hide(CddbSearchInAllCategories);
-            gtk_widget_hide(CddbSeparatorV);
-            gtk_widget_hide(CddbSearchInBluesCategory);
-            gtk_widget_hide(CddbSearchInClassicalCategory);
-            gtk_widget_hide(CddbSearchInCountryCategory);
-            gtk_widget_hide(CddbSearchInFolkCategory);
-            gtk_widget_hide(CddbSearchInJazzCategory);
-            gtk_widget_hide(CddbSearchInMiscCategory);
-            gtk_widget_hide(CddbSearchInNewageCategory);
-            gtk_widget_hide(CddbSearchInReggaeCategory);
-            gtk_widget_hide(CddbSearchInRockCategory);
-            gtk_widget_hide(CddbSearchInSoundtrackCategory);
-        }
-        // Force the window to be redrawed
-        gtk_widget_queue_resize(CddbWindow);
-    }
-}
+    priv = et_cddb_dialog_get_instance_private (self);
 
-static void
-Cddb_Search_In_All_Categories_Check_Button_Toggled (void)
-{
-    if (CddbSearchInAllCategories)
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->show_categories_toggle)))
     {
-        gtk_widget_set_sensitive(CddbSearchInBluesCategory,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInClassicalCategory, 
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInCountryCategory,   
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInFolkCategory,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInJazzCategory,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInMiscCategory,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInNewageCategory,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInReggaeCategory,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        gtk_widget_set_sensitive(CddbSearchInRockCategory,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
-        
gtk_widget_set_sensitive(CddbSearchInSoundtrackCategory,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories)));
+        gtk_widget_show(priv->separator_h);
+        gtk_widget_show(priv->categories_all_toggle);
+        gtk_widget_show(priv->separator_v);
+        gtk_widget_show(priv->categories_blues_toggle);
+        gtk_widget_show(priv->categories_classical_toggle);
+        gtk_widget_show(priv->categories_country_toggle);
+        gtk_widget_show(priv->categories_folk_toggle);
+        gtk_widget_show(priv->categories_jazz_toggle);
+        gtk_widget_show(priv->categories_misc_toggle);
+        gtk_widget_show(priv->categories_newage_toggle);
+        gtk_widget_show(priv->categories_reggae_toggle);
+        gtk_widget_show(priv->categories_rock_toggle);
+        gtk_widget_show(priv->categories_soundtrack_toggle);
     }
-}
-
-static void
-Cddb_Set_To_All_Fields_Check_Button_Toggled (void)
-{
-    if (CddbSetToAllFields)
+    else
     {
-        gtk_widget_set_sensitive(CddbSetToTitle,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        gtk_widget_set_sensitive(CddbSetToArtist,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        gtk_widget_set_sensitive(CddbSetToAlbum,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        gtk_widget_set_sensitive(CddbSetToYear,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        gtk_widget_set_sensitive(CddbSetToTrack,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        
gtk_widget_set_sensitive(CddbSetToTrackTotal,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        gtk_widget_set_sensitive(CddbSetToGenre,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
-        gtk_widget_set_sensitive(CddbSetToFileName,  
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields)));
+        gtk_widget_hide(priv->separator_h);
+        gtk_widget_hide(priv->categories_all_toggle);
+        gtk_widget_hide(priv->separator_v);
+        gtk_widget_hide(priv->categories_blues_toggle);
+        gtk_widget_hide(priv->categories_classical_toggle);
+        gtk_widget_hide(priv->categories_country_toggle);
+        gtk_widget_hide(priv->categories_folk_toggle);
+        gtk_widget_hide(priv->categories_jazz_toggle);
+        gtk_widget_hide(priv->categories_misc_toggle);
+        gtk_widget_hide(priv->categories_newage_toggle);
+        gtk_widget_hide(priv->categories_reggae_toggle);
+        gtk_widget_hide(priv->categories_rock_toggle);
+        gtk_widget_hide(priv->categories_soundtrack_toggle);
     }
+
+    /* Force the window to be redrawn. */
+    gtk_widget_queue_resize (GTK_WIDGET (self));
 }
 
 static void
-Cddb_Set_Apply_Button_Sensitivity (void)
+update_apply_button_sensitivity (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gboolean cddbsettoallfields, cddbsettotitle, cddbsettoartist, cddbsettoalbum,
              cddbsettoyear, cddbsettotrack, cddbsettotracktotal, cddbsettogenre, cddbsettofilename;
 
+    priv = et_cddb_dialog_get_instance_private (self);
+
     // Tag fields
-    cddbsettoallfields  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields));
-    cddbsettotitle      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTitle));
-    cddbsettoartist     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToArtist));
-    cddbsettoalbum      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAlbum));
-    cddbsettoyear       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToYear));
-    cddbsettotrack      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTrack));
-    cddbsettotracktotal = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTrackTotal));
-    cddbsettogenre      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToGenre));
-    cddbsettofilename   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToFileName));
-    if ( CddbApplyButton && gtk_tree_model_iter_n_children(GTK_TREE_MODEL(CddbTrackListModel), NULL) > 0
+    cddbsettoallfields  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle));
+    cddbsettotitle      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_title_toggle));
+    cddbsettoartist     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_artist_toggle));
+    cddbsettoalbum      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_album_toggle));
+    cddbsettoyear       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_year_toggle));
+    cddbsettotrack      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_tracknumber_toggle));
+    cddbsettotracktotal = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_totaltracks_toggle));
+    cddbsettogenre      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_genre_toggle));
+    cddbsettofilename   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_filename_toggle));
+    if ( priv->apply_button && gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv->track_list_model), NULL) 
0
     && (cddbsettoallfields || cddbsettotitle || cddbsettoartist     || cddbsettoalbum || cddbsettoyear
         || cddbsettotrack  || cddbsettotracktotal || cddbsettogenre || cddbsettofilename) )
     {
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbApplyButton),TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->apply_button),TRUE);
     } else
     {
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbApplyButton),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->apply_button),FALSE);
     }
 }
 
 static void
-Cddb_Use_Dlm_2_Check_Button_Toggled (void)
-{
-    if (CddbUseDLM2)
-    {
-        CDDB_USE_DLM = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseDLM2));
-    }
-}
-
-static void
-Cddb_Set_Search_Button_Sensitivity (void)
+update_search_button_sensitivity (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gboolean cddbinallfields, cddbinartistfield, cddbintitlefield, cddbintracknamefield, cddbinotherfield;
     gboolean cddbinallcategories, cddbinbluescategory, cddbinclassicalcategory, cddbincountrycategory,
              cddbinfolkcategory, cddbinjazzcategory, cddbinmisccategory, cddbinnewagecategory,
              cddbinreggaecategory, cddbinrockcategory, cddbinsoundtrackcategory;
 
+    priv = et_cddb_dialog_get_instance_private (self);
+
     // Fields
-    cddbinallfields      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields));
-    cddbinartistfield    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInArtistField));
-    cddbintitlefield     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInTitleField));
-    cddbintracknamefield = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInTrackNameField));
-    cddbinotherfield     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInOtherField));
+    cddbinallfields      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle));
+    cddbinartistfield    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_artist_toggle));
+    cddbintitlefield     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_title_toggle));
+    cddbintracknamefield = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_track_toggle));
+    cddbinotherfield     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_other_toggle));
     // Categories
-    cddbinallcategories      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories));
-    cddbinbluescategory      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInBluesCategory));
-    cddbinclassicalcategory  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInClassicalCategory));
-    cddbincountrycategory    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInCountryCategory));
-    cddbinfolkcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInFolkCategory));
-    cddbinjazzcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInJazzCategory));
-    cddbinmisccategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInMiscCategory));
-    cddbinnewagecategory     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInNewageCategory));
-    cddbinreggaecategory     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInReggaeCategory));
-    cddbinrockcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInRockCategory));
-    cddbinsoundtrackcategory = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInSoundtrackCategory));
-
-    if ( CddbSearchButton && CddbSearchStringCombo && 
g_utf8_strlen(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))), -1) > 0
+    cddbinallcategories      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle));
+    cddbinbluescategory      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_blues_toggle));
+    cddbinclassicalcategory  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_classical_toggle));
+    cddbincountrycategory    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_country_toggle));
+    cddbinfolkcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_folk_toggle));
+    cddbinjazzcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_jazz_toggle));
+    cddbinmisccategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_misc_toggle));
+    cddbinnewagecategory     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_newage_toggle));
+    cddbinreggaecategory     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_reggae_toggle));
+    cddbinrockcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_rock_toggle));
+    cddbinsoundtrackcategory = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_soundtrack_toggle));
+
+    if ( priv->search_button && g_utf8_strlen (gtk_entry_get_text (GTK_ENTRY (priv->search_string_entry)), 
-1) > 0
     && (cddbinallfields     || cddbinartistfield   || cddbintitlefield        || cddbintracknamefield || 
cddbinotherfield)
     && (cddbinallcategories || cddbinbluescategory || cddbinclassicalcategory || cddbincountrycategory
         || cddbinfolkcategory   || cddbinjazzcategory || cddbinmisccategory || cddbinnewagecategory
         || cddbinreggaecategory || cddbinrockcategory || cddbinsoundtrackcategory) )
     {
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbSearchButton),TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->search_button),TRUE);
     } else
     {
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbSearchButton),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->search_button),FALSE);
     }
 }
 
-static void
-Cddb_Stop_Search (void)
-{
-    CddbStopSearch = TRUE;
-}
-
 /*
  * Searches the Cddb Album List for specific terms
  * (this is not search the remote CDDB database...)
  */
 static void
-Cddb_Search_String_In_Result (GtkWidget *entry, GtkButton *button)
+find_previous_string_in_results (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gchar *string;
     gchar  buffer[256];
     gchar *pbuffer;
     gchar *text;
     gchar *temp;
-    gint   i;
-    gint  rowcount;
     GtkTreeSelection* treeSelection;
     GtkTreeIter iter;
     GtkTreePath *rowpath;
-    gboolean result;
     gboolean itemselected = FALSE;
-    GtkTreeIter itercopy;
 
-    if (!CddbWindow || !CddbAlbumListView)
-        return;
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    if (!entry || !button)
-        return;
-
-    string = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
+    string = g_strdup(gtk_entry_get_text(GTK_ENTRY(priv->search_string_in_results_entry)));
     if (!string || strlen(string)==0)
         return;
     temp = g_utf8_strdown(string, -1);
     g_free(string);
     string = temp;
 
-    Add_String_To_Combo_List(CddbSearchStringInResultModel, string);
+    Add_String_To_Combo_List(priv->search_string_in_result_model, string);
 
     /* Get the currently selected row into &iter and set itemselected to reflect this */
-    treeSelection = gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView));
+    treeSelection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->album_list_view));
     if (gtk_tree_selection_get_selected(treeSelection, NULL, &iter) == TRUE)
         itemselected = TRUE;
 
-    rowcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(CddbAlbumListModel), NULL);
+    /* Previous result button */
 
-    if (button != GTK_BUTTON(CddbSearchStringInResultPrevButton)) /* Next result button has been clicked */
+    /* Search in the album list (from bottom/selected-item to top) */
+    if (itemselected == TRUE)
     {
-        /* Search in the album list (from top to bottom) */
-        if (itemselected == TRUE)
-        {
-            gtk_tree_selection_unselect_iter(treeSelection, &iter);
-            result = gtk_tree_model_iter_next(GTK_TREE_MODEL(CddbAlbumListModel), &iter);
-        } else
-        {
-            result = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(CddbAlbumListModel), &iter);
-        }
+        rowpath = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->album_list_model), &iter);
+        gtk_tree_path_prev(rowpath);
+    } else
+    {
+        rowpath = 
gtk_tree_path_new_from_indices(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv->album_list_model), NULL) - 
1, -1);
+    }
 
-        itercopy = iter;
+    do
+    {
+        gboolean found;
 
-        /* If list entries follow the previously selected item, loop through them looking for a match */
-        if(result == TRUE)
+        found = gtk_tree_model_get_iter(GTK_TREE_MODEL(priv->album_list_model), &iter, rowpath);
+        if (found)
         {
-            do /* Search following results */
-            {
-                gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), &iter, CDDB_ALBUM_LIST_ALBUM, &text, 
-1);
-                g_utf8_strncpy(buffer, text, 256);
-
-                temp = g_utf8_strdown(buffer, -1);
-                pbuffer = temp;
+            gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), &iter, CDDB_ALBUM_LIST_ALBUM, &text, 
-1);
+            g_utf8_strncpy(buffer,text,256);
+            temp = g_utf8_strdown(buffer, -1);
+            pbuffer = temp;
 
-                if (pbuffer && strstr(pbuffer, string) != NULL)
-                {
-                    gtk_tree_selection_select_iter(treeSelection, &iter);
-                    rowpath = gtk_tree_model_get_path(GTK_TREE_MODEL(CddbAlbumListModel), &iter);
-                    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(CddbAlbumListView), rowpath, NULL, FALSE, 0, 
0);
-                    gtk_tree_path_free(rowpath);
-                    g_free(text);
-                    g_free(temp);
-                    g_free(string);
-                    return;
-                }
-                g_free(temp);
+            if (pbuffer && strstr(pbuffer,string) != NULL)
+            {
+                gtk_tree_selection_select_iter(treeSelection, &iter);
+                gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(priv->album_list_view), rowpath, NULL, FALSE, 0, 
0);
+                gtk_tree_path_free(rowpath);
                 g_free(text);
-            } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(CddbAlbumListModel), &iter));
+                g_free(temp);
+                g_free(string);
+                return;
+            }
+            g_free(temp);
+            g_free(text);
         }
+    } while(gtk_tree_path_prev(rowpath));
+    gtk_tree_path_free(rowpath);
+}
 
-        for (i = 0; i < rowcount; i++)
-        {
-            gboolean found;
+static void
+find_next_string_in_results (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    gchar *string;
+    gchar  buffer[256];
+    gchar *pbuffer;
+    gchar *text;
+    gchar *temp;
+    gint   i;
+    gint  rowcount;
+    GtkTreeSelection* treeSelection;
+    GtkTreeIter iter;
+    GtkTreePath *rowpath;
+    gboolean result;
+    gboolean itemselected = FALSE;
+    GtkTreeIter itercopy;
 
-            if (i == 0)
-                found = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(CddbAlbumListModel), &itercopy);
-            else
-                found = gtk_tree_model_iter_next(GTK_TREE_MODEL(CddbAlbumListModel), &itercopy);
+    priv = et_cddb_dialog_get_instance_private (self);
 
-            if (found)
-            {
-                gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), &itercopy, CDDB_ALBUM_LIST_ALBUM, 
&text, -1);
-                g_utf8_strncpy(buffer, text, 256);
+    string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_string_in_results_entry)));
+    if (!string || strlen(string)==0)
+        return;
+    temp = g_utf8_strdown(string, -1);
+    g_free(string);
+    string = temp;
 
-                temp = g_utf8_strdown(buffer, -1);
-                pbuffer = temp;
+    Add_String_To_Combo_List(priv->search_string_in_result_model, string);
 
-                if (pbuffer && strstr(pbuffer,string) != NULL)
-                {
-                    gtk_tree_selection_select_iter(treeSelection, &itercopy);
-                    rowpath = gtk_tree_model_get_path(GTK_TREE_MODEL(CddbAlbumListModel), &itercopy);
-                    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(CddbAlbumListView), rowpath, NULL, FALSE, 0, 
0);
-                    gtk_tree_path_free(rowpath);
-                    g_free(text);
-                    g_free(temp);
-                    g_free(string);
-                    return;
-                }
-                g_free(temp);
-                g_free(text);
-            }
-        }
+    /* Get the currently selected row into &iter and set itemselected to reflect this */
+    treeSelection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->album_list_view));
+    if (gtk_tree_selection_get_selected(treeSelection, NULL, &iter) == TRUE)
+        itemselected = TRUE;
+
+    rowcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv->album_list_model), NULL);
+
+    /* Search in the album list (from top to bottom) */
+    if (itemselected == TRUE)
+    {
+        gtk_tree_selection_unselect_iter(treeSelection, &iter);
+        result = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->album_list_model), &iter);
     } else
     {
-        /* Previous result button */
+        result = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->album_list_model), &iter);
+    }
 
-        /* Search in the album list (from bottom/selected-item to top) */
-        if (itemselected == TRUE)
-        {
-            rowpath = gtk_tree_model_get_path(GTK_TREE_MODEL(CddbAlbumListModel), &iter);
-            gtk_tree_path_prev(rowpath);
-        } else
-        {
-            rowpath = 
gtk_tree_path_new_from_indices(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(CddbAlbumListModel), NULL) - 1, 
-1);
-        }
+    itercopy = iter;
 
-        do
+    /* If list entries follow the previously selected item, loop through them looking for a match */
+    if(result == TRUE)
+    {
+        do /* Search following results */
         {
-            gboolean found;
+            gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), &iter, CDDB_ALBUM_LIST_ALBUM, &text, 
-1);
+            g_utf8_strncpy(buffer, text, 256);
 
-            found = gtk_tree_model_get_iter(GTK_TREE_MODEL(CddbAlbumListModel), &iter, rowpath);
-            if (found)
-            {
-                gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), &iter, CDDB_ALBUM_LIST_ALBUM, &text, 
-1);
-                g_utf8_strncpy(buffer,text,256);
-                temp = g_utf8_strdown(buffer, -1);
-                pbuffer = temp;
+            temp = g_utf8_strdown(buffer, -1);
+            pbuffer = temp;
 
-                if (pbuffer && strstr(pbuffer,string) != NULL)
-                {
-                    gtk_tree_selection_select_iter(treeSelection, &iter);
-                    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(CddbAlbumListView), rowpath, NULL, FALSE, 0, 
0);
-                    gtk_tree_path_free(rowpath);
-                    g_free(text);
-                    g_free(temp);
-                    g_free(string);
-                    return;
-                }
+            if (pbuffer && strstr(pbuffer, string) != NULL)
+            {
+                gtk_tree_selection_select_iter(treeSelection, &iter);
+                rowpath = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->album_list_model), &iter);
+                gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(priv->album_list_view), rowpath, NULL, FALSE, 0, 
0);
+                gtk_tree_path_free(rowpath);
+                g_free(text);
                 g_free(temp);
+                g_free(string);
+                return;
+            }
+            g_free(temp);
+            g_free(text);
+        } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->album_list_model), &iter));
+    }
+
+    for (i = 0; i < rowcount; i++)
+    {
+        gboolean found;
+
+        if (i == 0)
+            found = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->album_list_model), &itercopy);
+        else
+            found = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->album_list_model), &itercopy);
+
+        if (found)
+        {
+            gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), &itercopy, CDDB_ALBUM_LIST_ALBUM, 
&text, -1);
+            g_utf8_strncpy(buffer, text, 256);
+
+            temp = g_utf8_strdown(buffer, -1);
+            pbuffer = temp;
+
+            if (pbuffer && strstr(pbuffer,string) != NULL)
+            {
+                gtk_tree_selection_select_iter(treeSelection, &itercopy);
+                rowpath = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->album_list_model), &itercopy);
+                gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(priv->album_list_view), rowpath, NULL, FALSE, 0, 
0);
+                gtk_tree_path_free(rowpath);
                 g_free(text);
+                g_free(temp);
+                g_free(string);
+                return;
             }
-        } while(gtk_tree_path_prev(rowpath));
-        gtk_tree_path_free(rowpath);
+            g_free(temp);
+            g_free(text);
+        }
     }
     g_free(string);
 }
 
-
 /*
  * Show collected infos of the album in the status bar
  */
 static void
-Cddb_Show_Album_Info (GtkTreeSelection *selection, gpointer data)
+show_album_info (EtCDDBDialog *self, GtkTreeSelection *selection)
 {
+    EtCDDBDialogPrivate *priv;
     CddbAlbum *cddbalbum = NULL;
     gchar *msg, *duration_str;
     GtkTreeIter row;
-
-    if (!CddbWindow)
-        return;
+    priv = et_cddb_dialog_get_instance_private (self);
 
     if (gtk_tree_selection_get_selected(selection, NULL, &row))
     {
-        gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), &row, CDDB_ALBUM_LIST_DATA, &cddbalbum, -1);
+        gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), &row, CDDB_ALBUM_LIST_DATA, &cddbalbum, 
-1);
     }
     if (!cddbalbum)
         return;
@@ -1361,24 +579,26 @@ Cddb_Show_Album_Info (GtkTreeSelection *selection, gpointer data)
                             cddbalbum->year ? cddbalbum->year : "",
                             cddbalbum->genre ? cddbalbum->genre : "",
                             cddbalbum->id ? cddbalbum->id : "");
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar), CddbStatusBarContext, msg);
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar), priv->status_bar_context, msg);
     g_free(msg);
     g_free(duration_str);
 }
 
-
 /*
  * Select the corresponding file into the main file list
  */
 static void
-Cddb_Track_List_Row_Selected (GtkTreeSelection *selection, gpointer data)
+Cddb_Track_List_Row_Selected (EtCDDBDialog *self, GtkTreeSelection *selection)
 {
+    EtCDDBDialogPrivate *priv;
     GList       *selectedRows;
     GList *l;
     GtkTreeIter  currentFile;
     gchar       *text_path;
     ET_File    **etfile;
 
+    priv = et_cddb_dialog_get_instance_private (self);
+
     // Exit if we don't have to select files in the main list
     if (!CDDB_FOLLOW_FILE)
         return;
@@ -1398,20 +618,20 @@ Cddb_Track_List_Row_Selected (GtkTreeSelection *selection, gpointer data)
     {
         gboolean found;
 
-        found = gtk_tree_model_get_iter (GTK_TREE_MODEL (CddbTrackListModel),
+        found = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->track_list_model),
                                          &currentFile, (GtkTreePath*)l->data);
 
         if (found)
         {
             if (CDDB_USE_DLM)
             {
-                gtk_tree_model_get(GTK_TREE_MODEL(CddbTrackListModel), &currentFile,
+                gtk_tree_model_get(GTK_TREE_MODEL(priv->track_list_model), &currentFile,
                                    CDDB_TRACK_LIST_NAME, &text_path,
                                    CDDB_TRACK_LIST_ETFILE, &etfile, -1);
                 *etfile = Browser_List_Select_File_By_DLM(text_path, TRUE);
             } else
             {
-                text_path = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(CddbTrackListModel), 
&currentFile);
+                text_path = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->track_list_model), 
&currentFile);
                 Browser_List_Select_File_By_Iter_String(text_path, TRUE);
             }
             g_free(text_path);
@@ -1422,59 +642,28 @@ Cddb_Track_List_Row_Selected (GtkTreeSelection *selection, gpointer data)
 }
 
 /*
- * Unselect all rows in the track list
- */
-static void
-Cddb_Track_List_Unselect_All ()
-{
-    GtkTreeSelection *selection;
-
-    g_return_if_fail (CddbTrackListView != NULL);
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView));
-    if (selection)
-    {
-        gtk_tree_selection_unselect_all(selection);
-    }
-}
-
-/*
- * Select all rows in the track list
- */
-static void
-Cddb_Track_List_Select_All ()
-{
-    GtkTreeSelection *selection;
-
-    g_return_if_fail (CddbTrackListView != NULL);
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView));
-    if (selection)
-    {
-        gtk_tree_selection_select_all(selection);
-    }
-}
-
-/*
  * Invert the selection of every row in the track list
  */
 static void
-Cddb_Track_List_Invert_Selection ()
+Cddb_Track_List_Invert_Selection (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     GtkTreeSelection *selection;
     GtkTreeIter iter;
     gboolean valid;
 
-    g_return_if_fail (CddbTrackListView != NULL);
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView));
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->track_list_view));
 
     if (selection)
     {
         /* Must block the select signal to avoid selecting all files (one by one) in the main list */
-        g_signal_handlers_block_by_func(G_OBJECT(selection), G_CALLBACK(Cddb_Track_List_Row_Selected), NULL);
+        g_signal_handlers_block_by_func (selection,
+                                         G_CALLBACK (Cddb_Track_List_Row_Selected),
+                                         NULL);
 
-        valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(CddbTrackListModel), &iter);
+        valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(priv->track_list_model), &iter);
         while (valid)
         {
             if (gtk_tree_selection_iter_is_selected(selection, &iter))
@@ -1484,80 +673,183 @@ Cddb_Track_List_Invert_Selection ()
             {
                 gtk_tree_selection_select_iter(selection, &iter);
             }
-            valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(CddbTrackListModel), &iter);
+            valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->track_list_model), &iter);
         }
-        g_signal_handlers_unblock_by_func(G_OBJECT(selection), G_CALLBACK(Cddb_Track_List_Row_Selected), 
NULL);
-        g_signal_emit_by_name(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView))), 
"changed");
+        g_signal_handlers_unblock_by_func (selection,
+                                           G_CALLBACK (Cddb_Track_List_Row_Selected),
+                                           NULL);
+        g_signal_emit_by_name(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->track_list_view))), 
"changed");
     }
 }
 
-static gboolean
-Cddb_Track_List_Button_Press (GtkTreeView *treeView, GdkEventButton *event)
+/*
+ * Set the row apperance depending if we have cached info or not
+ * Bold/Red = Info are already loaded, but not displayed
+ * Italic/Light Red = Duplicate CDDB entry
+ */
+static void
+Cddb_Album_List_Set_Row_Appearance (EtCDDBDialog *self, GtkTreeIter *row)
 {
-    g_return_val_if_fail (event != NULL, FALSE);
+    EtCDDBDialogPrivate *priv;
+    CddbAlbum *cddbalbum = NULL;
+
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    if (event->type==GDK_2BUTTON_PRESS && event->button==1)
+    gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), row,
+                       CDDB_ALBUM_LIST_DATA, &cddbalbum, -1);
+
+    if (cddbalbum->track_list != NULL)
     {
-        /* Double left mouse click */
-        Cddb_Track_List_Select_All();
+        if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+        {
+            gtk_list_store_set(priv->album_list_model, row,
+                               CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
+                               CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_BOLD,
+                               CDDB_ALBUM_LIST_FOREGROUND_COLOR, NULL,-1);
+        } else
+        {
+            if (cddbalbum->other_version == TRUE)
+            {
+                const GdkRGBA LIGHT_RED = { 1.0, 0.5, 0.5, 1.0 };
+                gtk_list_store_set(priv->album_list_model, row,
+                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
+                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
+                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, &LIGHT_RED, -1);
+            } else
+            {
+                gtk_list_store_set(priv->album_list_model, row,
+                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
+                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
+                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, &RED, -1);
+            }
+        }
+    } else
+    {
+        if (cddbalbum->other_version == TRUE)
+        {
+            if (CHANGED_FILES_DISPLAYED_TO_BOLD)
+            {
+                gtk_list_store_set(priv->album_list_model, row,
+                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_ITALIC,
+                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
+                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, NULL,-1);
+            } else
+            {
+                const GdkRGBA GREY = { 0.664, 0.664, 0.664, 1.0 };
+                gtk_list_store_set(priv->album_list_model, row,
+                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
+                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
+                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, &GREY, -1);
+            }
+        } else
+        {
+            gtk_list_store_set(priv->album_list_model, row,
+                               CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
+                               CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
+                               CDDB_ALBUM_LIST_FOREGROUND_COLOR, NULL, -1);
+        }
     }
-    return FALSE;
 }
 
+/*
+ * Clear the album model, blocking the tree view selection changed handlers
+ * during the process, to prevent the handlers being called on removed rows.
+ */
+static void
+cddb_album_model_clear (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    GtkTreeSelection *selection;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->album_list_view));
+
+    g_signal_handlers_block_by_func (selection,
+                                     G_CALLBACK (Cddb_Get_Album_Tracks_List_CB),
+                                     self);
+    g_signal_handlers_block_by_func (selection, G_CALLBACK (show_album_info),
+                                     self);
+
+    gtk_list_store_clear (priv->album_list_model);
+
+    g_signal_handlers_unblock_by_func (selection, G_CALLBACK (show_album_info),
+                                       self);
+    g_signal_handlers_unblock_by_func (selection,
+                                       G_CALLBACK (Cddb_Get_Album_Tracks_List_CB),
+                                       self);
+}
 
 /*
- * To run an "automatic search" from a popup menu with the sélected files
+ * Clear the album model, blocking the tree view selection changed handlers
+ * during the process, to prevent the handlers being called on removed rows.
  */
-void Cddb_Popup_Menu_Search_Selected_File (void)
+static void
+cddb_track_model_clear (EtCDDBDialog *self)
 {
-    Open_Cddb_Window();
-    Cddb_Search_Album_From_Selected_Files();
+    EtCDDBDialogPrivate *priv;
+    GtkTreeSelection *selection;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->track_list_view));
+
+    g_signal_handlers_block_by_func (selection,
+                                     G_CALLBACK (Cddb_Track_List_Row_Selected),
+                                     self);
+
+    gtk_list_store_clear (priv->track_list_model);
+
+    g_signal_handlers_unblock_by_func (selection,
+                                       G_CALLBACK (Cddb_Track_List_Row_Selected),
+                                       self);
 }
 
 /*
- * Sort the track list
+ * Load the CddbTrackList into the corresponding List
  */
-static gint
-Cddb_Track_List_Sort_Func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
-                           gpointer data)
+static void
+Cddb_Load_Track_Album_List (EtCDDBDialog *self, GList *track_list)
 {
-    gint sortcol = GPOINTER_TO_INT(data);
-    gchar *text1, *text1cp;
-    gchar *text2, *text2cp;
-    gint num1;
-    gint num2;
-    gint ret = 0;
+    EtCDDBDialogPrivate *priv;
 
-    switch (sortcol)
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    if (track_list && priv->track_list_view)
     {
-        case SORT_LIST_NUMBER:
-            gtk_tree_model_get(model, a, CDDB_TRACK_LIST_NUMBER, &num1, -1);
-            gtk_tree_model_get(model, b, CDDB_TRACK_LIST_NUMBER, &num2, -1);
-            if (num1 < num2)
-                return -1;
-            else if(num1 > num2)
-                return 1;
-            else
-                return 0;
-            break;
+        GList *l;
 
-        case SORT_LIST_NAME:
-            gtk_tree_model_get(model, a, CDDB_TRACK_LIST_NAME, &text1, -1);
-            gtk_tree_model_get(model, b, CDDB_TRACK_LIST_NAME, &text2, -1);
-            text1cp = g_utf8_collate_key_for_filename(text1, -1);
-            text2cp = g_utf8_collate_key_for_filename(text2, -1);
-            // Must be the same rules as "ET_Comp_Func_Sort_File_By_Ascending_Filename" to be
-            // able to sort in the same order files in cddb and in the file list.
-            ret = SORTING_FILE_CASE_SENSITIVE ? strcmp(text1cp,text2cp) : strcasecmp(text1cp,text2cp);
+        /* Must block the select signal of the target to avoid looping. */
+        cddb_track_model_clear (self);
 
-            g_free(text1);
-            g_free(text2);
-            g_free(text1cp);
-            g_free(text2cp);
-            break;
-    }
+        for (l = g_list_first (track_list); l != NULL; l = g_list_next (l))
+        {
+            gchar *row_text[1];
+            CddbTrackAlbum *cddbtrackalbum = l->data;
+            ET_File **etfile;
+            etfile = g_malloc0(sizeof(ET_File *));
 
-    return ret;
+            row_text[0] = Convert_Duration((gulong)cddbtrackalbum->duration);
+
+            /* Load the row in the list. */
+            gtk_list_store_insert_with_values (priv->track_list_model, NULL,
+                                               G_MAXINT,
+                                               CDDB_TRACK_LIST_NUMBER,
+                                               cddbtrackalbum->track_number,
+                                               CDDB_TRACK_LIST_NAME,
+                                               cddbtrackalbum->track_name,
+                                               CDDB_TRACK_LIST_TIME,
+                                               row_text[0],
+                                               CDDB_TRACK_LIST_DATA,
+                                               cddbtrackalbum,
+                                               CDDB_TRACK_LIST_ETFILE, etfile,
+                                               -1);
+
+            g_free(row_text[0]);
+        }
+
+        update_apply_button_sensitivity (self);
+    }
 }
 
 /*
@@ -1571,8 +863,9 @@ Cddb_Track_List_Sort_Func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
  */
 /* TODO: Propagate the GError to the caller. */
 static gint
-Cddb_Open_Connection (const gchar *host, gint port)
+Cddb_Open_Connection (EtCDDBDialog *self, const gchar *host, gint port)
 {
+    EtCDDBDialogPrivate *priv;
     GSocketConnectable *address;
     GSocketAddressEnumerator *enumerator;
     GCancellable *cancellable;
@@ -1582,11 +875,14 @@ Cddb_Open_Connection (const gchar *host, gint port)
     gint socket_id = 0;
     gchar *msg;
 
-    g_return_val_if_fail (CddbWindow != NULL, 0);
+    g_return_val_if_fail (self != NULL, 0);
     g_return_val_if_fail (host != NULL && port > 0, 0);
 
+    priv = et_cddb_dialog_get_instance_private (self);
+
     msg = g_strdup_printf(_("Resolving host '%s'…"),host);
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+    gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
+                        priv->status_bar_context, msg);
     g_free(msg);
 
     while (gtk_events_pending ())
@@ -1628,8 +924,8 @@ Cddb_Open_Connection (const gchar *host, gint port)
         {
             msg = g_strdup_printf (_("Cannot create a new socket (%s)"),
                                    g_strerror (errno));
-            gtk_statusbar_push (GTK_STATUSBAR (CddbStatusBar),
-                                CddbStatusBarContext, msg);
+            gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
+                                priv->status_bar_context, msg);
             Log_Print (LOG_ERROR, "%s", msg);
             g_free (msg);
             goto err;
@@ -1646,8 +942,8 @@ Cddb_Open_Connection (const gchar *host, gint port)
         /* Open connection to the server. */
         msg = g_strdup_printf (_("Connecting to host '%s', port '%d'…"), host,
                                port);
-        gtk_statusbar_push (GTK_STATUSBAR (CddbStatusBar),
-                            CddbStatusBarContext, msg);
+        gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
+                            priv->status_bar_context, msg);
         g_free (msg);
 
         while (gtk_events_pending ())
@@ -1659,8 +955,8 @@ Cddb_Open_Connection (const gchar *host, gint port)
         {
             msg = g_strdup_printf (_("Cannot connect to host '%s' (%s)"), host,
                                    g_strerror (errno));
-            gtk_statusbar_push (GTK_STATUSBAR (CddbStatusBar),
-                                CddbStatusBarContext, msg);
+            gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
+                                priv->status_bar_context, msg);
             Log_Print (LOG_ERROR, "%s", msg);
             g_free (msg);
 
@@ -1683,8 +979,8 @@ Cddb_Open_Connection (const gchar *host, gint port)
     {
         msg = g_strdup_printf (_("Cannot resolve host '%s' (%s)"), host,
                                error->message);
-        gtk_statusbar_push (GTK_STATUSBAR (CddbStatusBar),
-                            CddbStatusBarContext, msg);
+        gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
+                            priv->status_bar_context, msg);
         Log_Print (LOG_ERROR, "%s", msg);
         g_free (msg);
         g_error_free (error);
@@ -1695,7 +991,7 @@ Cddb_Open_Connection (const gchar *host, gint port)
     g_object_unref (cancellable);
 
     msg = g_strdup_printf (_("Connected to host '%s'"), host);
-    gtk_statusbar_push (GTK_STATUSBAR (CddbStatusBar), CddbStatusBarContext,
+    gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar), priv->status_bar_context,
                         msg);
     g_free (msg);
 
@@ -1713,24 +1009,25 @@ err:
     return 0;
 }
 
-
 /*
  * Close the connection correcponding to the socket_id
  */
 static void
-Cddb_Close_Connection (gint socket_id)
+Cddb_Close_Connection (EtCDDBDialog *self, gint socket_id)
 {
+    EtCDDBDialogPrivate *priv;
+
 #ifndef G_OS_WIN32
     shutdown(socket_id,SHUT_RDWR);
 #endif /* !G_OS_WIN32 */
     close(socket_id);
 
-    if (!CddbWindow)
-        return;
+    g_return_if_fail (ET_CDDB_DIALOG (self));
 
-    CddbStopSearch = FALSE;
-}
+    priv = et_cddb_dialog_get_instance_private (self);
 
+    priv->stop_searching = FALSE;
+}
 
 /*
  * Read the result of the request and write it into a file.
@@ -1748,11 +1045,16 @@ Cddb_Close_Connection (gint socket_id)
  * [...]                                            } "Body"
  */
 static gint
-Cddb_Write_Result_To_File (gint socket_id, gulong *bytes_read_total)
+Cddb_Write_Result_To_File (EtCDDBDialog *self,
+                           gint socket_id,
+                           gulong *bytes_read_total)
 {
+    EtCDDBDialogPrivate *priv;
     gchar *file_path = NULL;
     FILE  *file;
 
+    priv = et_cddb_dialog_get_instance_private (self);
+
     /* Cache directory was already created by Log_Print(). */
     file_path = g_build_filename (g_get_user_cache_dir (), PACKAGE_TARNAME,
                                   CDDB_RESULT_FILE, NULL);
@@ -1762,7 +1064,7 @@ Cddb_Write_Result_To_File (gint socket_id, gulong *bytes_read_total)
         gchar cddb_out[MAX_STRING_LEN+1];
         gint  bytes_read = 0;
 
-        while ( CddbWindow && !CddbStopSearch
+        while ( self && !priv->stop_searching
         // Read data
         && (bytes_read = recv(socket_id,(void *)&cddb_out,MAX_STRING_LEN,0)) > 0 )
         {
@@ -1787,7 +1089,8 @@ Cddb_Write_Result_To_File (gint socket_id, gulong *bytes_read_total)
             // Display message
             size_str =  g_format_size (*bytes_read_total);
             msg = g_strdup_printf(_("Receiving data (%s)…"),size_str);
-            gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+            gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar),
+                                priv->status_bar_context, msg);
             g_free(msg);
             g_free(size_str);
             while (gtk_events_pending())
@@ -1813,369 +1116,519 @@ Cddb_Write_Result_To_File (gint socket_id, gulong *bytes_read_total)
     return 0;
 }
 
-
 /*
- * Read one line (of the connection) into cddb_out.
- * return  : -1 on error
- *            0 if no more line to read (EOF)
- *            1 if more lines to read
- *
- * Server answser is formated like this :
- *
- * HTTP/1.1 200 OK\r\n                              }
- * Server: Apache/1.3.19 (Unix) PHP/4.0.4pl1\r\n    } "Header"
- * Connection: close\r\n                            }
- * \r\n
- * <html>\n                                         }
- * [...]                                            } "Body"
+ * Look up a specific album in freedb, and save to a CddbAlbum structure
  */
-static gint
-Cddb_Read_Line (FILE **file, gchar **cddb_out)
+static gboolean
+Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
 {
-    gchar  buffer[MAX_STRING_LEN];
-    gchar *result;
-    size_t l;
+    EtCDDBDialogPrivate *priv;
+    gint       socket_id = 0;
+    CddbAlbum *cddbalbum = NULL;
+    GList     *TrackOffsetList = NULL;
+    gchar     *cddb_in, *cddb_out = NULL;
+    gchar     *cddb_end_str, *msg, *copy, *valid;
+    gchar     *proxy_auth;
+    gchar     *cddb_server_name;
+    gint       cddb_server_port;
+    gchar     *cddb_server_cgi_path;
+    gint       bytes_written;
+    gulong     bytes_read_total = 0;
+    FILE      *file = NULL;
+    gboolean   read_track_offset = FALSE;
+    GtkTreeIter row;
 
-    if (*file == NULL)
-    {
-        // Open the file for reading the first time
-        gchar *file_path;
+    priv = et_cddb_dialog_get_instance_private (self);
 
-        file_path = g_build_filename (g_get_user_cache_dir (), PACKAGE_TARNAME,
-                                      CDDB_RESULT_FILE, NULL);
+    cddb_track_model_clear (self);
+    update_apply_button_sensitivity (self);
 
-        if ((*file = fopen (file_path, "r")) == 0)
-        {
-            Log_Print (LOG_ERROR, _("Cannot open file '%s' (%s)"), file_path,
-                       g_strerror(errno));
-            g_free (file_path);
-            return -1; // Error!
-        }
-        g_free (file_path);
+    if (gtk_tree_selection_get_selected(selection, NULL, &row))
+    {
+        gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), &row, CDDB_ALBUM_LIST_DATA, &cddbalbum, 
-1);
     }
+    if (!cddbalbum)
+        return FALSE;
 
-    result = fgets(buffer,sizeof(buffer),*file);
-    if (result != NULL)
+    // We have already the track list
+    if (cddbalbum->track_list != NULL)
     {
-       l = strlen(buffer);
-        if (l > 0 && buffer[l-1] == '\n')
-            buffer[l-1] = '\0';
+        Cddb_Load_Track_Album_List (self, cddbalbum->track_list);
+        return TRUE;
+    }
 
-       // Many '\r' chars may be present
-        while ((l = strlen(buffer)) > 0 && buffer[l-1] == '\r')
-            buffer[l-1] = '\0';
+    // Parameters of the server used
+    cddb_server_name     = cddbalbum->server_name;
+    cddb_server_port     = cddbalbum->server_port;
+    cddb_server_cgi_path = cddbalbum->server_cgi_path;
+
+    if (!cddb_server_name)
+    {
+        // Local access
+        if ( (file=fopen(cddb_server_cgi_path,"r"))==0 )
+        {
+            Log_Print(LOG_ERROR,_("Can't load file: '%s' (%s)."),cddb_server_cgi_path,g_strerror(errno));
+            return FALSE;
+        }
 
-        *cddb_out = g_strdup(buffer);
     }else
     {
-        // On error, or EOF
-        fclose(*file);
-        *file = NULL;
+        /* Remote access. */
+        /* Connection to the server. */
+        if ((socket_id = Cddb_Open_Connection (self,
+                                               CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
+                                               CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 0)
+            return FALSE;
 
-        //*cddb_out = NULL;
-        *cddb_out = g_strdup(""); // To avoid a crash
+               if ( strstr(cddb_server_name,"gnudb") != NULL )
+               {
+                       // For gnudb
+                       // New version of gnudb doesn't use a cddb request, but a http request
+                   cddb_in = g_strdup_printf("GET %s%s/gnudb/"
+                                             "%s/%s"
+                                             " HTTP/1.1\r\n"
+                                             "Host: %s:%d\r\n"
+                                             "User-Agent: %s %s\r\n"
+                                             "%s"
+                                             "Connection: close\r\n"
+                                             "\r\n",
+                                             CDDB_USE_PROXY?"http://":"";, 
CDDB_USE_PROXY?cddb_server_name:"",  // Needed when using proxy
+                                             cddbalbum->category,cddbalbum->id,
+                                             cddb_server_name,cddb_server_port,
+                                             PACKAGE_NAME, PACKAGE_VERSION,
+                                             (proxy_auth=Cddb_Format_Proxy_Authentification())
+                                             );
+               }else
+               {
+                   // CDDB Request (ex: GET 
/~cddb/cddb.cgi?cmd=cddb+read+jazz+0200a401&hello=noname+localhost+EasyTAG+0.31&proto=1 HTTP/1.1\r\nHost: 
freedb.freedb.org:80\r\nConnection: close)
+                   // Without proxy : "GET /~cddb/cddb.cgi?…" but doesn't work with a proxy.
+                   // With proxy    : "GET http://freedb.freedb.org/~cddb/cddb.cgi?…";
+                   cddb_in = g_strdup_printf("GET %s%s%s?cmd=cddb+read+"
+                                             "%s+%s"
+                                             "&hello=noname+localhost+%s+%s"
+                                             "&proto=6 HTTP/1.1\r\n"
+                                             "Host: %s:%d\r\n"
+                                             "%s"
+                                             "Connection: close\r\n\r\n",
+                                             CDDB_USE_PROXY?"http://":"",CDDB_USE_PROXY?cddb_server_name:"";, 
cddb_server_cgi_path,
+                                             cddbalbum->category,cddbalbum->id,
+                                             PACKAGE_NAME, PACKAGE_VERSION,
+                                             cddb_server_name,cddb_server_port,
+                                             (proxy_auth=Cddb_Format_Proxy_Authentification())
+                                             );
+               }
 
-        return 0;
-    }
+               
+               g_free(proxy_auth);
+        //g_print("Request Cddb_Get_Album_Tracks_List : '%s'\n", cddb_in);
 
-    //g_print("Line read: %s\n",*cddb_out);
-    return 1;
-}
+        // Send the request
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Sending request…"));
+        while (gtk_events_pending()) gtk_main_iteration();
+        if ( (bytes_written=send(socket_id,cddb_in,strlen(cddb_in)+1,0)) < 0)
+        {
+            Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
+            Cddb_Close_Connection (self, socket_id);
+            g_free(cddb_in);
+            return FALSE;
+        }
+        g_free(cddb_in);
 
 
-/*
- * Read HTTP header data : from "HTTP/1.1 200 OK" to the blank line
- */
-static gint
-Cddb_Read_Http_Header (FILE **file, gchar **cddb_out)
-{
+        // Read the answer
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Receiving data…"));
+        while (gtk_events_pending())
+            gtk_main_iteration();
 
-    // The 'file' is opened (if no error) in this function
-    if ( Cddb_Read_Line(file,cddb_out) < 0 )
-        return -1; // Error!
+        /* Write result in a file. */
+        if (Cddb_Write_Result_To_File (self, socket_id, &bytes_read_total) < 0)
+        {
+            msg = g_strdup(_("The server returned a bad response"));
+            gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
+            Log_Print(LOG_ERROR,"%s",msg);
+            g_free(msg);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
+            return FALSE;
+        }
 
-    // First line must be : "HTTP/1.1 200 OK"
-    if ( !*cddb_out || strncmp("HTTP",*cddb_out,4)!=0 || strstr(*cddb_out,"200 OK")==NULL )
-        return -1;
 
-    /* Read until end of the HTTP header up to the next blank line. */
-    do
-    {
-        g_free (*cddb_out);
-    }
-    while (Cddb_Read_Line (file, cddb_out) > 0
-           && *cddb_out && strlen (*cddb_out) > 0);
+        // Parse server answer : Check HTTP Header (freedb or gnudb) and CDDB Header (freedb only)
+        file = NULL;
+               if ( strstr(cddb_server_name,"gnudb") != NULL )
+               {
+                       // For gnudb (don't check CDDB header)
+                       if ( Cddb_Read_Http_Header(&file,&cddb_out) <= 0 )
+                   {
+                       gchar *msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
+                       gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
+                       Log_Print(LOG_ERROR,"%s",msg);
+                       g_free(msg);
+                       g_free(cddb_out);
+                       if (file)
+                           fclose(file);
+                       return FALSE;
+                   }
+               }else
+               {
+                       // For freedb
+                       if ( Cddb_Read_Http_Header(&file,&cddb_out) <= 0
+                     || Cddb_Read_Cddb_Header(&file,&cddb_out) <= 0 )
+                   {
+                       gchar *msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
+                       gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
+                       Log_Print(LOG_ERROR,"%s",msg);
+                       g_free(msg);
+                       g_free(cddb_out);
+                       if (file)
+                           fclose(file);
+                       return FALSE;
+                   }
+               }
+        g_free(cddb_out);
 
-    //g_print("Http Header : %s\n",*cddb_out);
-    return 1;
-}
+    }
+    cddb_end_str = g_strdup(".");
 
-/*
- * Read CDDB header data when requesting a file (cmd=cddb+read+<album genre>+<discid>)
- * Must be read after the HTTP header :
- *
- *      HTTP/1.1 200 OK
- *      Date: Sun, 26 Nov 2006 22:37:13 GMT
- *      Server: Apache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5 PHP/4.3.10-16 proxy_html/2.4 
mod_perl/1.999.21 Perl/v5.8.4
- *      Expires: Sun Nov 26 23:37:14 2006
- *      Content-Length: 1013
- *      Connection: close
- *      Content-Type: text/plain; charset=UTF-8
- *
- *      210 newage 710ed208 CD database entry follows (until terminating `.')
- *
- * Cddb Header is the line like this :
- *      210 newage 710ed208 CD database entry follows (until terminating `.')
- */
-static gint
-Cddb_Read_Cddb_Header (FILE **file, gchar **cddb_out)
-{
-    if ( Cddb_Read_Line(file,cddb_out) < 0 )
-        return -1; // Error!
+    while ( self && !priv->stop_searching
+    && Cddb_Read_Line(&file,&cddb_out) > 0 )
+    {
+        if (!cddb_out) // Empty line?
+            continue;
+        //g_print("%s\n",cddb_out);
 
-    // Some requests receive some strange data (arbitrary : less than 10 chars.)
-    // at the beginning (2 or 3 characters)... So we read one line more...
-    if ( !*cddb_out || strlen(*cddb_out) < 10 )
-        if ( Cddb_Read_Line(file,cddb_out) < 0 )
-            return -1; // Error!
+        // To avoid the cddb lookups to hang (Patch from Paul Giordano)
+        /* It appears that on some systems that cddb lookups continue to attempt
+         * to get data from the socket even though the other system has completed
+         * sending. The fix adds one check to the loops to see if the actual
+         * end of data is in the last block read. In this case, the last line
+         * will be a single '.'
+         */
+        if (strlen(cddb_out)<=3 && strstr(cddb_out,cddb_end_str)!=NULL)
+            break;
 
-    //g_print("Cddb Header : %s\n",*cddb_out);
+        if ( strstr(cddb_out,"Track frame offsets")!=NULL ) // We read the Track frame offset
+        {
+            read_track_offset = TRUE; // The next reads are for the tracks offset
+            continue;
 
-    // Read the line
-    // 200 - exact match
-    // 210 - multiple exact matches
-    // 211 - inexact match
-    if ( *cddb_out == NULL
-    || (strncmp(*cddb_out,"200",3)!=0
-    &&  strncmp(*cddb_out,"210",3)!=0
-    &&  strncmp(*cddb_out,"211",3)!=0) )
-        return -1;
+        }else if (read_track_offset) // We are reading a track offset? (generates TrackOffsetList)
+        {
+            if ( strtoul(cddb_out+1,NULL,10)>0 )
+            {
+                CddbTrackFrameOffset *cddbtrackframeoffset = g_malloc0(sizeof(CddbTrackFrameOffset));
+                cddbtrackframeoffset->offset = strtoul(cddb_out+1,NULL,10);
+                TrackOffsetList = g_list_append(TrackOffsetList,cddbtrackframeoffset);
+            }else
+            {
+                read_track_offset = FALSE; // No more track offset
+            }
+            continue;
 
-    return 1;
-}
+        }else if ( strstr(cddb_out,"Disc length: ")!=NULL ) // Length of album (in second)
+        {
+            cddbalbum->duration = atoi(strchr(cddb_out,':')+1);
+            if (TrackOffsetList) // As it must be the last item, do nothing if no previous data
+            {
+                CddbTrackFrameOffset *cddbtrackframeoffset = g_malloc0(sizeof(CddbTrackFrameOffset));
+                cddbtrackframeoffset->offset = cddbalbum->duration * 75; // It's the last offset
+                TrackOffsetList = g_list_append(TrackOffsetList,cddbtrackframeoffset);
+            }
+            continue;
 
+        }else if ( strncmp(cddb_out,"DTITLE=",7)==0 ) // "Artist / Album" names
+        {
+            // Note : disc title too long take severals lines. For example :
+            // DTITLE=Marilyn Manson / The Nobodies (2005 Against All Gods Mix - Korea Tour L
+            // DTITLE=imited Edition)
+            if (!cddbalbum->album)
+            {
+                // It is the first time we find DTITLE...
 
+                gchar *alb_ptr = strstr(cddb_out," / ");
+                // Album
+                if (alb_ptr && alb_ptr+3)
+                {
+                    cddbalbum->album = Try_To_Validate_Utf8_String(alb_ptr+3);
+                    *alb_ptr = 0;
+                }
 
-/*
- * Free the CddbAlbumList
- */
-static gboolean
-Cddb_Free_Album_List (void)
-{
-    GList *l;
+                // Artist
+                cddbalbum->artist = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DTITLE='
+            }else
+            {
+                // It is at least the second time we find DTITLE
+                // So we suppose that only the album was truncated
 
-    g_return_val_if_fail (CddbAlbumList != NULL, FALSE);
+                // Album
+                valid = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DTITLE='
+                copy = cddbalbum->album; // To free...
+                cddbalbum->album = g_strconcat(cddbalbum->album,valid,NULL);
+                g_free(copy);
+            }
+            continue;
 
-    CddbAlbumList = g_list_first (CddbAlbumList);
+        }else if ( strncmp(cddb_out,"DYEAR=",6)==0 ) // Year
+        {
+            valid = Try_To_Validate_Utf8_String(cddb_out+6); // '6' to skip 'DYEAR='
+            if (g_utf8_strlen(valid, -1))
+                cddbalbum->year = valid;
+            continue;
 
-    for (l = CddbAlbumList; l != NULL; l = g_list_next (l))
-    {
-        CddbAlbum *cddbalbum = l->data;
+        }else if ( strncmp(cddb_out,"DGENRE=",7)==0 ) // Genre
+        {
+            valid = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DGENRE='
+            if (g_utf8_strlen(valid, -1))
+                cddbalbum->genre = valid;
+            continue;
 
-        if (cddbalbum)
+        }else if ( strncmp(cddb_out,"TTITLE",6)==0 ) // Track title (for exemple : TTITLE10=xxxx)
         {
-            g_free(cddbalbum->server_name);
-            g_free (cddbalbum->server_cgi_path);
-            g_object_unref(cddbalbum->bitmap);
+            CddbTrackAlbum *cddbtrackalbum_last = NULL;
 
-            g_free(cddbalbum->artist_album);
-            g_free(cddbalbum->category);
-            g_free(cddbalbum->id);
+            CddbTrackAlbum *cddbtrackalbum = g_malloc0(sizeof(CddbTrackAlbum));
+            cddbtrackalbum->cddbalbum = cddbalbum; // To find the CddbAlbum father quickly
+
+            // Here is a fix when TTITLExx doesn't contain an "=", we skip the line
+            if ( (copy = g_utf8_strchr(cddb_out,-1,'=')) != NULL )
+            {
+                cddbtrackalbum->track_name = Try_To_Validate_Utf8_String(copy+1);
+            }else
+            {
+                continue;
+            }
+
+            *g_utf8_strchr(cddb_out,-1,'=') = 0;
+            cddbtrackalbum->track_number = atoi(cddb_out+6)+1;
+
+            // Note : titles too long take severals lines. For example :
+            // TTITLE15=Bob Marley vs. Funkstar De Luxe Remix - Sun Is Shining (Radio De Lu
+            // TTITLE15=xe Edit)
+            // So to check it, we compare current track number with the previous one...
             if (cddbalbum->track_list)
+                cddbtrackalbum_last = g_list_last(cddbalbum->track_list)->data;
+            if (cddbtrackalbum_last && cddbtrackalbum_last->track_number == cddbtrackalbum->track_number)
             {
-                Cddb_Free_Track_Album_List(cddbalbum->track_list);
-                cddbalbum->track_list = NULL;
+                gchar *track_name = 
g_strconcat(cddbtrackalbum_last->track_name,cddbtrackalbum->track_name,NULL);
+                g_free(cddbtrackalbum_last->track_name);
+
+                cddbtrackalbum_last->track_name = Try_To_Validate_Utf8_String(track_name);
+
+                // Frees useless allocated data previously
+                g_free(cddbtrackalbum->track_name);
+                g_free(cddbtrackalbum);
+            }else
+            {
+                if (TrackOffsetList && TrackOffsetList->next)
+                {
+                    cddbtrackalbum->duration = ( ((CddbTrackFrameOffset 
*)TrackOffsetList->next->data)->offset - ((CddbTrackFrameOffset *)TrackOffsetList->data)->offset ) / 75; // 
Calculate time in seconds
+                    TrackOffsetList = TrackOffsetList->next;
+                }
+                cddbalbum->track_list = g_list_append(cddbalbum->track_list,cddbtrackalbum);
             }
-            g_free(cddbalbum->artist);
-            g_free(cddbalbum->album);
-            g_free(cddbalbum->genre);
-            g_free(cddbalbum->year);
+            continue;
 
-            g_free(cddbalbum);
-            cddbalbum = NULL;
+        }else if ( strncmp(cddb_out,"EXTD=",5)==0 ) // Extended album data
+        {
+            gchar *genre_ptr = strstr(cddb_out,"ID3G:");
+            gchar *year_ptr  = strstr(cddb_out,"YEAR:");
+            // May contains severals EXTD field it too long
+            // EXTD=Techno
+            // EXTD= YEAR: 1997 ID3G:  18
+            // EXTD= ID3G:  17
+            if (year_ptr && cddbalbum->year)
+                cddbalbum->year = g_strdup_printf("%d",atoi(year_ptr+5));
+            if (genre_ptr && cddbalbum->genre)
+                cddbalbum->genre = g_strdup(Id3tag_Genre_To_String(atoi(genre_ptr+5)));
+            continue;
         }
+
+        g_free(cddb_out);
     }
+    g_free(cddb_end_str);
 
-    g_list_free(CddbAlbumList);
+    // Close file opened for reading lines
+    if (file)
+    {
+        fclose(file);
+        file = NULL;
+    }
 
+    if (cddb_server_name)
+    {
+        /* Remote access. */
+        /* Close connection */
+        Cddb_Close_Connection (self, socket_id);
+    }
+
+    /* Set color of the selected row (without reloading the whole list) */
+    Cddb_Album_List_Set_Row_Appearance (self, &row);
+
+    /* Load the track list of the album */
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Loading album track 
list…"));
+    while (gtk_events_pending()) gtk_main_iteration();
+    Cddb_Load_Track_Album_List (self, cddbalbum->track_list);
+
+    show_album_info (self, gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->album_list_view)));
+
+    // Frees 'TrackOffsetList'
+    g_list_free_full (TrackOffsetList, (GDestroyNotify)g_free);
+    TrackOffsetList = NULL;
     return TRUE;
 }
 
+/*
+ * Callback when selecting a row in the Album List.
+ * We get the list of tracks of the selected album
+ */
 static gboolean
-Cddb_Free_Track_Album_List (GList *track_list)
+Cddb_Get_Album_Tracks_List_CB (EtCDDBDialog *self, GtkTreeSelection *selection)
 {
-    GList *l;
-
-    g_return_val_if_fail (track_list != NULL, FALSE);
-
-    track_list = g_list_first (track_list);
+    gint i;
+    gint i_max = 5;
 
-    for (l = track_list; l != NULL; l = g_list_next (l))
+    /* As may be not opened the first time (The server returned a wrong answer!)
+     * me try to reconnect severals times */
+    for (i = 1; i <= i_max; i++)
     {
-        CddbTrackAlbum *cddbtrackalbum = l->data;
-        if (cddbtrackalbum)
+        if (Cddb_Get_Album_Tracks_List (self, selection) == TRUE)
         {
-            g_free(cddbtrackalbum->track_name);
-            g_free(cddbtrackalbum);
-            cddbtrackalbum = NULL;
+            break;
         }
     }
-
-    g_list_free (track_list);
-
-    return TRUE;
+    if (i <= i_max)
+    {
+        return TRUE;
+    } else
+    {
+        return FALSE;
+    }
 }
 
 /*
- * Clear the album model, blocking the tree view selection changed handlers
- * during the process, to prevent the handlers being called on removed rows.
+ * Load the priv->album_list into the corresponding List
  */
 static void
-cddb_album_model_clear (void)
+Cddb_Load_Album_List (EtCDDBDialog *self, gboolean only_red_lines)
 {
+    EtCDDBDialogPrivate *priv;
+    GtkTreeIter iter;
+    GList *l;
+
     GtkTreeSelection *selection;
+    GList            *selectedRows = NULL;
+    GtkTreeIter       currentIter;
+    CddbAlbum        *cddbalbumSelected = NULL;
 
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (CddbAlbumListView));
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    g_signal_handlers_block_by_func (selection,
-                                     G_CALLBACK (Cddb_Get_Album_Tracks_List_CB),
-                                     NULL);
-    g_signal_handlers_block_by_func (selection,
-                                     G_CALLBACK (Cddb_Show_Album_Info),
-                                     NULL);
+    // Memorize the current selected item
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->album_list_view));
+    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+    if (selectedRows)
+    {
+        if (gtk_tree_model_get_iter(GTK_TREE_MODEL(priv->album_list_model), &currentIter, 
(GtkTreePath*)selectedRows->data))
+            gtk_tree_model_get(GTK_TREE_MODEL(priv->album_list_model), &currentIter,
+                               CDDB_ALBUM_LIST_DATA, &cddbalbumSelected, -1);
+    }
 
-    gtk_list_store_clear (CddbAlbumListModel);
+    /* Remove lines. */
+    cddb_album_model_clear (self);
 
-    g_signal_handlers_unblock_by_func (selection,
-                                       G_CALLBACK (Cddb_Show_Album_Info),
-                                       NULL);
-    g_signal_handlers_unblock_by_func (selection,
-                                       G_CALLBACK (Cddb_Get_Album_Tracks_List_CB),
-                                       NULL);
+    // Reload list following parameter 'only_red_lines'
+    for (l = g_list_first (priv->album_list); l != NULL; l = g_list_next (l))
+    {
+        CddbAlbum *cddbalbum = l->data;
+
+        if ( (only_red_lines && cddbalbum->track_list) || !only_red_lines)
+        {
+            /* Load the row in the list. */
+            gtk_list_store_insert_with_values (priv->album_list_model, &iter,
+                                               G_MAXINT,
+                                               CDDB_ALBUM_LIST_PIXBUF,
+                                               cddbalbum->bitmap,
+                                               CDDB_ALBUM_LIST_ALBUM,
+                                               cddbalbum->artist_album,
+                                               CDDB_ALBUM_LIST_CATEGORY,
+                                               cddbalbum->category,
+                                               CDDB_ALBUM_LIST_DATA,
+                                               cddbalbum, -1);
+
+            Cddb_Album_List_Set_Row_Appearance (self, &iter);
+
+            // Select this item if it is the saved one...
+            if (cddbalbum == cddbalbumSelected)
+                
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->album_list_view)), &iter);
+        }
+    }
 }
 
-/*
- * Clear the album model, blocking the tree view selection changed handlers
- * during the process, to prevent the handlers being called on removed rows.
- */
 static void
-cddb_track_model_clear (void)
+Cddb_Display_Red_Lines_In_Result (EtCDDBDialog *self)
 {
-    GtkTreeSelection *selection;
-
-    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (CddbTrackListView));
-
-    g_signal_handlers_block_by_func (selection,
-                                     G_CALLBACK (Cddb_Track_List_Row_Selected),
-                                     NULL);
+    EtCDDBDialogPrivate *priv;
 
-    gtk_list_store_clear (CddbTrackListModel);
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    g_signal_handlers_unblock_by_func (selection,
-                                       G_CALLBACK (Cddb_Track_List_Row_Selected),
-                                       NULL);
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->display_red_lines_toggle)))
+    {
+        /* Show only red lines. */
+        Cddb_Load_Album_List (self, TRUE);
+    }
+    else
+    {
+        /* Show all lines. */
+        Cddb_Load_Album_List (self, FALSE);
+    }
 }
 
 /*
- * Load the CddbAlbumList into the corresponding List
+ * Free priv->album_list
  */
-static void
-Cddb_Load_Album_List (gboolean only_red_lines)
+static gboolean
+Cddb_Free_Album_List (EtCDDBDialog *self)
 {
-    if (CddbWindow && CddbAlbumList && CddbAlbumListView)
-    {
-        GtkTreeIter iter;
-        GList *l;
+    EtCDDBDialogPrivate *priv;
+    GList *l;
 
-        GtkTreeSelection *selection;
-        GList            *selectedRows = NULL;
-        GtkTreeIter       currentIter;
-        CddbAlbum        *cddbalbumSelected = NULL;
+    priv = et_cddb_dialog_get_instance_private (self);
 
-        // Memorize the current selected item
-        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView));
-        selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
-        if (selectedRows)
-        {
-            if (gtk_tree_model_get_iter(GTK_TREE_MODEL(CddbAlbumListModel), &currentIter, 
(GtkTreePath*)selectedRows->data))
-                gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), &currentIter,
-                                   CDDB_ALBUM_LIST_DATA, &cddbalbumSelected, -1);
-        }
+    g_return_val_if_fail (priv->album_list != NULL, FALSE);
 
-        /* Remove lines. */
-        cddb_album_model_clear ();
+    priv->album_list = g_list_first (priv->album_list);
+
+    for (l = priv->album_list; l != NULL; l = g_list_next (l))
+    {
+        CddbAlbum *cddbalbum = l->data;
 
-        // Reload list following parameter 'only_red_lines'
-        for (l = g_list_first (CddbAlbumList); l != NULL; l = g_list_next (l))
+        if (cddbalbum)
         {
-            CddbAlbum *cddbalbum = l->data;
+            g_free(cddbalbum->server_name);
+            g_free (cddbalbum->server_cgi_path);
+            g_object_unref(cddbalbum->bitmap);
 
-            if ( (only_red_lines && cddbalbum->track_list) || !only_red_lines)
+            g_free(cddbalbum->artist_album);
+            g_free(cddbalbum->category);
+            g_free(cddbalbum->id);
+            if (cddbalbum->track_list)
             {
-                /* Load the row in the list. */
-                gtk_list_store_insert_with_values (CddbAlbumListModel, &iter,
-                                                   G_MAXINT,
-                                                   CDDB_ALBUM_LIST_PIXBUF,
-                                                   cddbalbum->bitmap,
-                                                   CDDB_ALBUM_LIST_ALBUM,
-                                                   cddbalbum->artist_album,
-                                                   CDDB_ALBUM_LIST_CATEGORY,
-                                                   cddbalbum->category,
-                                                   CDDB_ALBUM_LIST_DATA,
-                                                   cddbalbum, -1);
-
-                Cddb_Album_List_Set_Row_Appearance(&iter);
-
-                // Select this item if it is the saved one...
-                if (cddbalbum == cddbalbumSelected)
-                    
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView)), &iter);
+                Cddb_Free_Track_Album_List(cddbalbum->track_list);
+                cddbalbum->track_list = NULL;
             }
+            g_free(cddbalbum->artist);
+            g_free(cddbalbum->album);
+            g_free(cddbalbum->genre);
+            g_free(cddbalbum->year);
+
+            g_free(cddbalbum);
+            cddbalbum = NULL;
         }
     }
-}
-
-
-/*
- * Load the CddbTrackList into the corresponding List
- */
-static void
-Cddb_Load_Track_Album_List (GList *track_list)
-{
-    if (CddbWindow && track_list && CddbTrackListView)
-    {
-        GList *l;
-
-        /* Must block the select signal of the target to avoid looping. */
-        cddb_track_model_clear ();
-
-        for (l = g_list_first (track_list); l != NULL; l = g_list_next (l))
-        {
-            gchar *row_text[1];
-            CddbTrackAlbum *cddbtrackalbum = l->data;
-            ET_File **etfile;
-            etfile = g_malloc0(sizeof(ET_File *));
 
-            row_text[0] = Convert_Duration((gulong)cddbtrackalbum->duration);
+    g_list_free (priv->album_list);
+    priv->album_list = NULL;
 
-            /* Load the row in the list. */
-            gtk_list_store_insert_with_values (CddbTrackListModel, NULL,
-                                               G_MAXINT,
-                                               CDDB_TRACK_LIST_NUMBER,
-                                               cddbtrackalbum->track_number,
-                                               CDDB_TRACK_LIST_NAME,
-                                               cddbtrackalbum->track_name,
-                                               CDDB_TRACK_LIST_TIME,
-                                               row_text[0],
-                                               CDDB_TRACK_LIST_DATA,
-                                               cddbtrackalbum,
-                                               CDDB_TRACK_LIST_ETFILE, etfile,
-                                               -1);
-
-            g_free(row_text[0]);
-        }
-
-        Cddb_Set_Apply_Button_Sensitivity();
-    }
+    return TRUE;
 }
 
 /*
@@ -2183,23 +1636,26 @@ Cddb_Load_Track_Album_List (GList *track_list)
  * CDDB Categories : blues, classical, country, data, folk, jazz, misc, newage, reggae, rock, soundtrack
  */
 static gchar *
-Cddb_Generate_Request_String_With_Fields_And_Categories_Options (void)
+Cddb_Generate_Request_String_With_Fields_And_Categories_Options (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gchar string[256];
     gboolean cddbinallfields, cddbinartistfield, cddbintitlefield, cddbintracknamefield, cddbinotherfield;
     gboolean cddbinallcategories, cddbinbluescategory, cddbinclassicalcategory, cddbincountrycategory,
              cddbinfolkcategory, cddbinjazzcategory, cddbinmisccategory, cddbinnewagecategory,
              cddbinreggaecategory, cddbinrockcategory, cddbinsoundtrackcategory;
 
-    // Init
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    /* Init. */
     string[0] = 0;
 
-    // Fields
-    cddbinallfields      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllFields));
-    cddbinartistfield    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInArtistField));
-    cddbintitlefield     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInTitleField));
-    cddbintracknamefield = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInTrackNameField));
-    cddbinotherfield     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInOtherField));
+    /* Fields. */
+    cddbinallfields = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_all_toggle));
+    cddbinartistfield = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_artist_toggle));
+    cddbintitlefield = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_title_toggle));
+    cddbintracknamefield = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_track_toggle));
+    cddbinotherfield = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->search_other_toggle));
 
     if (cddbinallfields)      strncat(string,"&allfields=YES",14);
     else                      strncat(string,"&allfields=NO",13);
@@ -2211,17 +1667,17 @@ Cddb_Generate_Request_String_With_Fields_And_Categories_Options (void)
 
 
     // Categories (warning : there is one other CDDB catogories not used here ("data"))
-    cddbinallcategories      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInAllCategories));
-    cddbinbluescategory      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInBluesCategory));
-    cddbinclassicalcategory  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInClassicalCategory));
-    cddbincountrycategory    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInCountryCategory));
-    cddbinfolkcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInFolkCategory));
-    cddbinjazzcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInJazzCategory));
-    cddbinmisccategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInMiscCategory));
-    cddbinnewagecategory     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInNewageCategory));
-    cddbinreggaecategory     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInReggaeCategory));
-    cddbinrockcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInRockCategory));
-    cddbinsoundtrackcategory = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSearchInSoundtrackCategory));
+    cddbinallcategories      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle));
+    cddbinbluescategory      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_blues_toggle));
+    cddbinclassicalcategory  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_classical_toggle));
+    cddbincountrycategory    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_country_toggle));
+    cddbinfolkcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_folk_toggle));
+    cddbinjazzcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_jazz_toggle));
+    cddbinmisccategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_misc_toggle));
+    cddbinnewagecategory     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_newage_toggle));
+    cddbinreggaecategory     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_reggae_toggle));
+    cddbinrockcategory       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_rock_toggle));
+    cddbinsoundtrackcategory = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_soundtrack_toggle));
 
     strncat(string,"&allcats=NO",11);
     if (cddbinallcategories)
@@ -2248,30 +1704,14 @@ Cddb_Generate_Request_String_With_Fields_And_Categories_Options (void)
 
 
 /*
- * Select the function to use according the server adress for the manual search
- *      - freedb.freedb.org
- *      - gnudb.gnudb.org
- */
-static gboolean
-Cddb_Search_Album_List_From_String (void)
-{
-    if ( strstr(CDDB_SERVER_NAME_MANUAL_SEARCH,"gnudb") != NULL )
-               // Use of gnudb
-        return Cddb_Search_Album_List_From_String_Gnudb();
-    else
-               // Use of freedb
-        return Cddb_Search_Album_List_From_String_Freedb();
-}
-
-
-/*
  * Site FREEDB.ORG - Manual Search
  * Send request (using the HTML search page in freedb.org site) to the CD database
  * to get the list of albums matching to a string.
  */
 static gboolean
-Cddb_Search_Album_List_From_String_Freedb (void)
+Cddb_Search_Album_List_From_String_Freedb (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gint   socket_id;
     gchar *string = NULL;
     gchar *tmp, *tmp1;
@@ -2295,10 +1735,12 @@ Cddb_Search_Album_List_From_String_Freedb (void)
     FILE  *file = NULL;
     gboolean web_search_disabled = FALSE;
 
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,"");
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,"");
 
     /* Get words to search... */
-    string = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))));
+    string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_string_entry)));
     if (!string || g_utf8_strlen(string, -1) <= 0)
         return FALSE;
 
@@ -2313,7 +1755,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
         *tmp = '\0';
     }
 
-    Add_String_To_Combo_List(CddbSearchStringModel, string);
+    Add_String_To_Combo_List(priv->search_string_model, string);
 
     /* Convert spaces to '+' */
     while ( (tmp=strchr(string,' '))!=NULL )
@@ -2324,12 +1766,13 @@ Cddb_Search_Album_List_From_String_Freedb (void)
     cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_MANUAL_SEARCH);//"/~cddb/cddb.cgi");
 
     /* Connection to the server */
-    if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
-                                         CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+    if ((socket_id = Cddb_Open_Connection (self,
+                                           CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
+                                           CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 0)
     {
-        g_free(string);
-        g_free(cddb_server_name);
-       g_free(cddb_server_cgi_path);
+        g_free (string);
+        g_free (cddb_server_name);
+        g_free (cddb_server_cgi_path);
         return FALSE;
     }
 
@@ -2347,7 +1790,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
                               "\r\n",
                               CDDB_USE_PROXY?"http://":"";, CDDB_USE_PROXY?cddb_server_name:"",  // Needed 
when using proxy
                               string,
-                              (tmp=Cddb_Generate_Request_String_With_Fields_And_Categories_Options()),
+                              (tmp = Cddb_Generate_Request_String_With_Fields_And_Categories_Options (self)),
                               cddb_server_name,cddb_server_port,
                               PACKAGE_NAME, PACKAGE_VERSION,
                               (proxy_auth=Cddb_Format_Proxy_Authentification())
@@ -2359,12 +1802,12 @@ Cddb_Search_Album_List_From_String_Freedb (void)
     //g_print("Request Cddb_Search_Album_List_From_String_Freedb : '%s'\n", cddb_in);
 
     // Send the request
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Sending request…"));
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Sending request…"));
     while (gtk_events_pending()) gtk_main_iteration();
     if ( (bytes_written=send(socket_id,cddb_in,strlen(cddb_in)+1,0)) < 0)
     {
         Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
-        Cddb_Close_Connection(socket_id);
+        Cddb_Close_Connection (self, socket_id);
         g_free(cddb_in);
         g_free(string);
         g_free(cddb_server_name);
@@ -2375,36 +1818,36 @@ Cddb_Search_Album_List_From_String_Freedb (void)
 
 
     /* Delete previous album list. */
-    cddb_album_model_clear ();
-    cddb_track_model_clear ();
+    cddb_album_model_clear (self);
+    cddb_track_model_clear (self);
 
-    if (CddbAlbumList)
+    if (priv->album_list)
     {
-        Cddb_Free_Album_List();
-        CddbAlbumList = NULL;
+        Cddb_Free_Album_List (self);
     }
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),TRUE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),TRUE);
+    gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_search_button), TRUE);
+    gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_auto_search_button),
+                              TRUE);
 
 
     /*
      * Read the answer
      */
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Receiving data…"));
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Receiving data…"));
     while (gtk_events_pending())
         gtk_main_iteration();
 
-    // Write result in a file
-    if (Cddb_Write_Result_To_File(socket_id,&bytes_read_total) < 0)
+    /* Write result in a file. */
+    if (Cddb_Write_Result_To_File (self, socket_id, &bytes_read_total) < 0)
     {
         msg = g_strdup(_("The server returned a bad response"));
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
         Log_Print(LOG_ERROR,"%s",msg);
         g_free(msg);
         g_free(cddb_server_name);
         g_free(cddb_server_cgi_path);
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
         return FALSE;
     }
 
@@ -2412,14 +1855,14 @@ Cddb_Search_Album_List_From_String_Freedb (void)
     if (Cddb_Read_Http_Header(&file,&cddb_out) <= 0 || !cddb_out) // Order is important!
     {
         msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
         Log_Print(LOG_ERROR,"%s",msg);
         g_free(msg);
         g_free(cddb_out);
         g_free(cddb_server_name);
         g_free(cddb_server_cgi_path);
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
         if (file)
             fclose(file);
         return FALSE;
@@ -2435,7 +1878,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
     art_alb_str  = g_strdup("\">");
     end_str      = g_strdup("</a>"); //"</a><br>");
     html_end_str = g_strdup("</body>"); // To avoid the cddb lookups to hang
-    while ( CddbWindow && !CddbStopSearch
+    while ( self && !priv->stop_searching
     && Cddb_Read_Line(&file,&cddb_out) > 0 )
     {
         cddb_out_tmp = cddb_out;
@@ -2523,7 +1966,7 @@ Cddb_Search_Album_List_From_String_Freedb (void)
             // New position the search the next string
             cddb_out_tmp = strstr(cddb_out_tmp,end_str) + strlen(end_str);
 
-            CddbAlbumList = g_list_append(CddbAlbumList,cddbalbum);
+            priv->album_list = g_list_append(priv->album_list,cddbalbum);
         }
 
         // To avoid the cddb lookups to hang (Patch from Paul Giordano)
@@ -2551,37 +1994,37 @@ Cddb_Search_Album_List_From_String_Freedb (void)
         file = NULL;
     }
 
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
 
-    // Close connection
-    Cddb_Close_Connection(socket_id);
+    /* Close connection. */
+    Cddb_Close_Connection (self, socket_id);
 
     if (web_search_disabled)
         msg = g_strdup_printf(_("Sorry, the web-based search is currently not available"));
     else
-        msg = g_strdup_printf(ngettext("Found one matching album","Found %d matching 
albums",g_list_length(CddbAlbumList)),g_list_length(CddbAlbumList));
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        msg = g_strdup_printf(ngettext("Found one matching album","Found %d matching 
albums",g_list_length(priv->album_list)),g_list_length(priv->album_list));
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
     g_free(msg);
 
     // Initialize the button
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbDisplayRedLinesButton),FALSE);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->display_red_lines_toggle),FALSE);
 
-    // Load the albums found in the list
-    Cddb_Load_Album_List(FALSE);
+    /* Load the albums found in the list. */
+    Cddb_Load_Album_List (self, FALSE);
 
     return TRUE;
 }
 
-
 /*
  * Site GNUDB.ORG - Manual Search
  * Send request (using the HTML search page in freedb.org site) to the CD database
  * to get the list of albums matching to a string.
  */
 static gboolean
-Cddb_Search_Album_List_From_String_Gnudb (void)
+Cddb_Search_Album_List_From_String_Gnudb (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gint   socket_id;
     gchar *string = NULL;
     gchar *tmp, *tmp1;
@@ -2609,11 +2052,12 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
     gint   next_page_cpt = 0;
     gboolean next_page_found;
 
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,"");
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,"");
 
     /* Get words to search... */
-    string = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(CddbSearchStringCombo)))));
+    string = g_strdup (gtk_entry_get_text (GTK_ENTRY (priv->search_string_entry)));
     if (!string || g_utf8_strlen(string, -1) <= 0)
         return FALSE;
 
@@ -2628,24 +2072,22 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
         *tmp = '\0';
     }
 
-    Add_String_To_Combo_List(CddbSearchStringModel, string);
+    Add_String_To_Combo_List(priv->search_string_model, string);
 
     /* Convert spaces to '+' */
     while ( (tmp=strchr(string,' '))!=NULL )
         *tmp = '+';
 
-
     /* Delete previous album list. */
-    cddb_album_model_clear ();
-    cddb_track_model_clear ();
+    cddb_album_model_clear (self);
+    cddb_track_model_clear (self);
 
-    if (CddbAlbumList)
+    if (priv->album_list)
     {
-        Cddb_Free_Album_List();
-        CddbAlbumList = NULL;
+        Cddb_Free_Album_List (self);
     }
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),TRUE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),TRUE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),TRUE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),TRUE);
 
 
     // Do a loop to load all the pages of results
@@ -2656,14 +2098,15 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
         cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_MANUAL_SEARCH);//"/~cddb/cddb.cgi");
 
         /* Connection to the server */
-        if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
-                                             CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+        if ((socket_id = Cddb_Open_Connection (self,
+                                               CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
+                                               CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 0)
         {
             g_free(string);
             g_free(cddb_server_name);
             g_free(cddb_server_cgi_path);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
             return FALSE;
         }
 
@@ -2690,18 +2133,20 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
         //g_print("Request Cddb_Search_Album_List_From_String_Gnudb : '%s'\n", cddb_in);
 
         // Send the request
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Sending request…"));
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Sending request…"));
         while (gtk_events_pending()) gtk_main_iteration();
         if ( (bytes_written=send(socket_id,cddb_in,strlen(cddb_in)+1,0)) < 0)
         {
             Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
-            Cddb_Close_Connection(socket_id);
-            g_free(cddb_in);
-            g_free(string);
-            g_free(cddb_server_name);
-            g_free(cddb_server_cgi_path);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+            Cddb_Close_Connection (self, socket_id);
+            g_free (cddb_in);
+            g_free (string);
+            g_free (cddb_server_name);
+            g_free (cddb_server_cgi_path);
+            gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_search_button),
+                                      FALSE);
+            gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_auto_search_button),
+                                      FALSE);
             return FALSE;
         }
         g_free(cddb_in);
@@ -2715,23 +2160,23 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
         else
             msg = g_strdup_printf(_("Receiving data of page %d…"),next_page_cpt);
 
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
         g_free(msg);
         while (gtk_events_pending())
             gtk_main_iteration();
 
-        // Write result in a file
-        if (Cddb_Write_Result_To_File(socket_id,&bytes_read_total) < 0)
+        /* Write result in a file. */
+        if (Cddb_Write_Result_To_File (self, socket_id, &bytes_read_total) < 0)
         {
             msg = g_strdup(_("The server returned a bad response"));
-            gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+            gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
             Log_Print(LOG_ERROR,"%s",msg);
             g_free(msg);
             g_free(string);
             g_free(cddb_server_name);
             g_free(cddb_server_cgi_path);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
             return FALSE;
         }
 
@@ -2740,15 +2185,15 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
         if (Cddb_Read_Http_Header(&file,&cddb_out) <= 0 || !cddb_out) // Order is important!
         {
             msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
-            gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+            gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
             Log_Print(LOG_ERROR,"%s",msg);
             g_free(msg);
             g_free(cddb_out);
             g_free(string);
             g_free(cddb_server_name);
             g_free(cddb_server_cgi_path);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
             if (file)
                 fclose(file);
             return FALSE;
@@ -2772,7 +2217,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
         sraf_str     = g_strdup("<h2>Search Results, ");
         sraf_end_str = g_strdup(" albums found:</h2>");
 
-        while ( CddbWindow && !CddbStopSearch
+        while ( self && !priv->stop_searching
         && Cddb_Read_Line(&file,&cddb_out) > 0 )
         {
             cddb_out_tmp = cddb_out;
@@ -2855,7 +2300,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
                     *ptr_end = 0;
                 cddbalbum->artist_album = Try_To_Validate_Utf8_String(buffer);
 
-                CddbAlbumList = g_list_append(CddbAlbumList,cddbalbum);
+                priv->album_list = g_list_append(priv->album_list,cddbalbum);
             }
 
             // To avoid the cddb lookups to hang (Patch from Paul Giordano)
@@ -2878,7 +2323,7 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
                 if ( !(next_page_cpt < 2) ) // Don't display message in this case as it will be displayed 
each line of page 0 and 1
                 {
                     msg = g_strdup_printf(_("More results to load…"));
-                    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+                    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
                     g_free(msg);
 
                     while (gtk_events_pending())
@@ -2900,37 +2345,1499 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
             file = NULL;
         }
 
-        // Close connection
-        Cddb_Close_Connection(socket_id);
+        /* Close connection. */
+        Cddb_Close_Connection (self, socket_id);
 
     } while (next_page_found);
     g_free(string);
 
 
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
 
     msg = g_strdup_printf(ngettext("Found one matching album","Found %d matching 
albums",num_albums),num_albums);
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
     g_free(msg);
 
     // Initialize the button
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbDisplayRedLinesButton),FALSE);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->display_red_lines_toggle),FALSE);
+
+    /* Load the albums found in the list. */
+    Cddb_Load_Album_List (self, FALSE);
+
+    return TRUE;
+}
+
+/*
+ * Select the function to use according the server adress for the manual search
+ *      - freedb.freedb.org
+ *      - gnudb.gnudb.org
+ */
+static gboolean
+Cddb_Search_Album_List_From_String (EtCDDBDialog *self)
+{
+    if (strstr (CDDB_SERVER_NAME_MANUAL_SEARCH, "gnudb") != NULL)
+        /* Use gnudb. */
+        return Cddb_Search_Album_List_From_String_Gnudb (self);
+    else
+        /* Use freedb. */
+        return Cddb_Search_Album_List_From_String_Freedb (self);
+}
+
+/*
+ * Set CDDB data (from tracks list) into tags of the main file list
+ */
+static gboolean
+Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    guint row;
+    guint list_length;
+    guint rows_to_loop = 0;
+    guint selectedcount;
+    guint file_selectedcount;
+    guint counter = 0;
+    GList *file_iterlist = NULL;
+    GList *file_selectedrows;
+    GList *selectedrows = NULL;
+    gchar buffer[256];
+    gboolean CddbTrackList_Line_Selected;
+    gboolean cddbsettoallfields, cddbsettotitle,      cddbsettoartist, cddbsettoalbum, cddbsettoyear,
+             cddbsettotrack,     cddbsettotracktotal, cddbsettogenre,  cddbsettofilename;
+    CddbTrackAlbum *cddbtrackalbum = NULL;
+    GtkTreeSelection *selection = NULL;
+    GtkTreeSelection *file_selection = NULL;
+    GtkListStore *fileListModel;
+    GtkTreePath *currentPath = NULL;
+    GtkTreeIter  currentIter;
+    GtkTreeIter *fileIter;
+    gpointer iterptr;
+
+    g_return_val_if_fail (BrowserList != NULL
+                          && ETCore->ETFileDisplayedList != NULL, FALSE);
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    // Save the current displayed data
+    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
+
+    cddbsettoallfields  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle));
+    cddbsettotitle      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_title_toggle));
+    cddbsettoartist     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_artist_toggle));
+    cddbsettoalbum      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_album_toggle));
+    cddbsettoyear       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_year_toggle));
+    cddbsettotrack      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_tracknumber_toggle));
+    cddbsettotracktotal = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_totaltracks_toggle));
+    cddbsettogenre      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_genre_toggle));
+    cddbsettofilename   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_filename_toggle));
+
+    fileListModel = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(BrowserList)));
+    list_length = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv->track_list_model), NULL);
+
+    // Take the selected files in the cddb track list, else the full list
+    // Note : Just used to calculate "cddb_track_list_length" because
+    // "GPOINTER_TO_INT(cddb_track_list->data)" doesn't return the number of the
+    // line when "cddb_track_list = g_list_first(GTK_CLIST(CddbTrackCList)->row_list)"
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->track_list_view));
+    selectedcount = gtk_tree_selection_count_selected_rows(selection);
+
+    /* Check if at least one line was selected. No line selected is equal to all lines selected. */
+    CddbTrackList_Line_Selected = FALSE;
+
+    if (selectedcount > 0)
+    {
+        /* Loop through selected rows only */
+        CddbTrackList_Line_Selected = TRUE;
+        rows_to_loop = selectedcount;
+        selectedrows = gtk_tree_selection_get_selected_rows(selection, NULL);
+    } else
+    {
+        /* Loop through all rows */
+        CddbTrackList_Line_Selected = FALSE;
+        rows_to_loop = list_length;
+    }
+
+    file_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
+    file_selectedcount = gtk_tree_selection_count_selected_rows(file_selection);
+
+    if (file_selectedcount > 0)
+    {
+        GList *l;
+
+        /* Rows are selected in the file list, apply tags to them only */
+        file_selectedrows = gtk_tree_selection_get_selected_rows(file_selection, NULL);
+
+        for (l = file_selectedrows; l != NULL; l = g_list_next (l))
+        {
+            counter++;
+            iterptr = g_malloc0(sizeof(GtkTreeIter));
+            if (gtk_tree_model_get_iter (GTK_TREE_MODEL (fileListModel),
+                                         (GtkTreeIter *)iterptr,
+                                         (GtkTreePath *)l->data))
+            {
+                file_iterlist = g_list_prepend (file_iterlist, iterptr);
+            }
+
+            if (counter == rows_to_loop) break;
+        }
+
+        /* Free the useless bit */
+        g_list_free_full (file_selectedrows,
+                          (GDestroyNotify)gtk_tree_path_free);
+
+    } else /* No rows selected, use the first x items in the list */
+    {
+        gtk_tree_model_get_iter_first(GTK_TREE_MODEL(fileListModel), &currentIter);
+
+        do
+        {
+            counter++;
+            iterptr = g_memdup(&currentIter, sizeof(GtkTreeIter));
+            file_iterlist = g_list_prepend (file_iterlist, iterptr);
+        } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(fileListModel), &currentIter));
+
+        file_selectedcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(fileListModel), NULL);
+    }
+
+    if (file_selectedcount != rows_to_loop)
+    {
+        GtkWidget *msgdialog;
+        gint response;
+
+        msgdialog = gtk_message_dialog_new(GTK_WINDOW(self),
+                                           GTK_DIALOG_MODAL  | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                           GTK_MESSAGE_QUESTION,
+                                           GTK_BUTTONS_NONE,
+                                           "%s",
+                                           _("The number of CDDB results does not match the number of 
selected files"));
+        
gtk_dialog_add_buttons(GTK_DIALOG(msgdialog),GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_APPLY,GTK_RESPONSE_APPLY,
 NULL);
+        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(msgdialog),"%s","Do you want to 
continue?");
+        gtk_window_set_title (GTK_WINDOW (msgdialog),
+                              _("Write Tag from CDDB"));
+        response = gtk_dialog_run(GTK_DIALOG(msgdialog));
+        gtk_widget_destroy(msgdialog);
+
+        if (response != GTK_RESPONSE_APPLY)
+        {
+            g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
+            //gdk_window_raise(CddbWindow->window);
+            return FALSE;
+        }
+    }
+
+    file_iterlist = g_list_reverse (file_iterlist);
+    //ET_Debug_Print_File_List (NULL, __FILE__, __LINE__, __FUNCTION__);
+
+    for (row=0; row < rows_to_loop; row++)
+    {
+        if (CddbTrackList_Line_Selected == FALSE)
+        {
+            if(row == 0)
+                currentPath = gtk_tree_path_new_first();
+            else
+                gtk_tree_path_next(currentPath);
+        } else /* (e.g.: if CddbTrackList_Line_Selected == TRUE) */
+        {
+            if(row == 0)
+            {
+                selectedrows = g_list_first(selectedrows);
+                currentPath = (GtkTreePath *)selectedrows->data;
+            } else
+            {
+                selectedrows = g_list_next(selectedrows);
+                currentPath = (GtkTreePath *)selectedrows->data;
+            }
+        }
+
+        if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->track_list_model),
+                                     &currentIter, currentPath))
+        {
+            gtk_tree_model_get (GTK_TREE_MODEL (priv->track_list_model),
+                                &currentIter, CDDB_TRACK_LIST_DATA,
+                                &cddbtrackalbum, -1);
+        }
+        else
+        {
+            g_warning ("Iter not found matching path in CDDB track list model");
+        }
+
+        // Set values in the ETFile
+        if (CDDB_USE_DLM)
+        {
+            // RQ : this part is ~ equal to code for '!CDDB_USE_DLM', but uses '*etfile' instead of 'etfile'
+            ET_File **etfile = NULL;
+            File_Name *FileName = NULL;
+            File_Tag *FileTag = NULL;
+
+            gtk_tree_model_get(GTK_TREE_MODEL(priv->track_list_model), &currentIter,
+                               CDDB_TRACK_LIST_ETFILE, &etfile, -1);
+
+            /*
+             * Tag fields
+             */
+            if (cddbsettoallfields || cddbsettotitle || cddbsettoartist
+                || cddbsettoalbum || cddbsettoyear || cddbsettotrack
+                || cddbsettotracktotal || cddbsettogenre)
+            {
+                // Allocation of a new FileTag
+                FileTag = ET_File_Tag_Item_New();
+                ET_Copy_File_Tag_Item(*etfile,FileTag);
+
+                if (cddbsettoallfields || cddbsettotitle)
+                    ET_Set_Field_File_Tag_Item(&FileTag->title,cddbtrackalbum->track_name);
+
+                if ( (cddbsettoallfields || cddbsettoartist) && cddbtrackalbum->cddbalbum->artist)
+                    ET_Set_Field_File_Tag_Item(&FileTag->artist,cddbtrackalbum->cddbalbum->artist);
+
+                if ( (cddbsettoallfields || cddbsettoalbum) && cddbtrackalbum->cddbalbum->album)
+                    ET_Set_Field_File_Tag_Item(&FileTag->album, cddbtrackalbum->cddbalbum->album);
+
+                if ( (cddbsettoallfields || cddbsettoyear) && cddbtrackalbum->cddbalbum->year)
+                    ET_Set_Field_File_Tag_Item(&FileTag->year,  cddbtrackalbum->cddbalbum->year);
+
+                if (cddbsettoallfields || cddbsettotrack)
+                {
+                    snprintf (buffer, sizeof (buffer), "%s",
+                              et_track_number_to_string (cddbtrackalbum->track_number));
+
+                    ET_Set_Field_File_Tag_Item(&FileTag->track,buffer);
+                }
+
+                if (cddbsettoallfields || cddbsettotracktotal)
+                {
+                    snprintf (buffer, sizeof (buffer), "%s",
+                              et_track_number_to_string (list_length));
+
+                    ET_Set_Field_File_Tag_Item(&FileTag->track_total,buffer);
+                }
+
+                if ( (cddbsettoallfields || cddbsettogenre) && (cddbtrackalbum->cddbalbum->genre || 
cddbtrackalbum->cddbalbum->category) )
+                {
+                    if (cddbtrackalbum->cddbalbum->genre && g_utf8_strlen(cddbtrackalbum->cddbalbum->genre, 
-1)>0)
+                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->genre));
+                    else
+                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->category));
+                }
+            }
+
+            /*
+             * Filename field
+             */
+            if ( (cddbsettoallfields || cddbsettofilename) )
+            {
+                gchar *filename_generated_utf8;
+                gchar *filename_new_utf8;
+
+                // Allocation of a new FileName
+                FileName = ET_File_Name_Item_New();
+
+                // Build the filename with the path
+                snprintf (buffer, sizeof (buffer), "%s",
+                          et_track_number_to_string (cddbtrackalbum->track_number));
+
+                filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
+                ET_File_Name_Convert_Character(filename_generated_utf8); // Replace invalid characters
+                filename_new_utf8 = ET_File_Name_Generate(*etfile,filename_generated_utf8);
+
+                ET_Set_Filename_File_Name_Item(FileName,filename_new_utf8,NULL);
+
+                g_free(filename_generated_utf8);
+                g_free(filename_new_utf8);
+            }
 
-    // Load the albums found in the list
-    Cddb_Load_Album_List(FALSE);
+            ET_Manage_Changes_Of_File_Data(*etfile,FileName,FileTag);
+
+            /* Then run current scanner if requested. */
+            if (ScannerWindow && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
+            {
+                Scan_Select_Mode_And_Run_Scanner (*etfile);
+            }
+        }
+        else if (cddbtrackalbum && file_iterlist && file_iterlist->data)
+        {
+            ET_File   *etfile;
+            File_Name *FileName = NULL;
+            File_Tag  *FileTag  = NULL;
+
+            fileIter = (GtkTreeIter*) file_iterlist->data;
+            etfile = Browser_List_Get_ETFile_From_Iter(fileIter);
+
+            /*
+             * Tag fields
+             */
+            if (cddbsettoallfields || cddbsettotitle || cddbsettoartist
+                || cddbsettoalbum || cddbsettoyear || cddbsettotrack
+                || cddbsettotracktotal || cddbsettogenre)
+            {
+                // Allocation of a new FileTag
+                FileTag = ET_File_Tag_Item_New();
+                ET_Copy_File_Tag_Item(etfile,FileTag);
+
+                if (cddbsettoallfields || cddbsettotitle)
+                    ET_Set_Field_File_Tag_Item(&FileTag->title,cddbtrackalbum->track_name);
+
+                if ( (cddbsettoallfields || cddbsettoartist) && cddbtrackalbum->cddbalbum->artist)
+                    ET_Set_Field_File_Tag_Item(&FileTag->artist,cddbtrackalbum->cddbalbum->artist);
+
+                if ( (cddbsettoallfields || cddbsettoalbum) && cddbtrackalbum->cddbalbum->album)
+                    ET_Set_Field_File_Tag_Item(&FileTag->album, cddbtrackalbum->cddbalbum->album);
+
+                if ( (cddbsettoallfields || cddbsettoyear) && cddbtrackalbum->cddbalbum->year)
+                    ET_Set_Field_File_Tag_Item(&FileTag->year,  cddbtrackalbum->cddbalbum->year);
+
+                if (cddbsettoallfields || cddbsettotrack)
+                {
+                    snprintf (buffer, sizeof (buffer), "%s",
+                              et_track_number_to_string (cddbtrackalbum->track_number));
+
+                    ET_Set_Field_File_Tag_Item(&FileTag->track,buffer);
+                }
+
+                if (cddbsettoallfields || cddbsettotracktotal)
+                {
+                    snprintf (buffer, sizeof (buffer), "%s",
+                              et_track_number_to_string (list_length));
+
+                    ET_Set_Field_File_Tag_Item(&FileTag->track_total,buffer);
+                }
+
+                if ( (cddbsettoallfields || cddbsettogenre) && (cddbtrackalbum->cddbalbum->genre || 
cddbtrackalbum->cddbalbum->category) )
+                {
+                    if (cddbtrackalbum->cddbalbum->genre && g_utf8_strlen(cddbtrackalbum->cddbalbum->genre, 
-1)>0)
+                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->genre));
+                    else
+                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->category));
+                }
+            }
+
+            /*
+             * Filename field
+             */
+            if ( (cddbsettoallfields || cddbsettofilename) )
+            {
+                gchar *filename_generated_utf8;
+                gchar *filename_new_utf8;
+
+                // Allocation of a new FileName
+                FileName = ET_File_Name_Item_New();
+
+                // Build the filename with the path
+                snprintf (buffer, sizeof (buffer), "%s",
+                          et_track_number_to_string (cddbtrackalbum->track_number));
+
+                filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
+                ET_File_Name_Convert_Character(filename_generated_utf8); // Replace invalid characters
+                filename_new_utf8 = ET_File_Name_Generate(etfile,filename_generated_utf8);
+
+                ET_Set_Filename_File_Name_Item(FileName,filename_new_utf8,NULL);
+
+                g_free(filename_generated_utf8);
+                g_free(filename_new_utf8);
+            }
+
+            ET_Manage_Changes_Of_File_Data(etfile,FileName,FileTag);
+
+            /* Then run current scanner if requested. */
+            if (ScannerWindow && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
+            {
+                Scan_Select_Mode_And_Run_Scanner (etfile);
+            }
+        }
+
+        if(!file_iterlist->next) break;
+        file_iterlist = file_iterlist->next;
+    }
+
+    g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
+
+    Browser_List_Refresh_Whole_List();
+    ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
 
     return TRUE;
 }
 
+static void
+stop_search (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    priv->stop_searching = TRUE;
+}
+
+/*
+ * Unselect all rows in the track list
+ */
+static void
+track_list_unselect_all (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    GtkTreeSelection *selection;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    g_return_if_fail (priv->track_list_view != NULL);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->track_list_view));
+    if (selection)
+    {
+        gtk_tree_selection_unselect_all (selection);
+    }
+}
+
+/*
+ * Select all rows in the track list
+ */
+static void
+track_list_select_all (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    GtkTreeSelection *selection;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->track_list_view));
+
+    if (selection)
+    {
+        gtk_tree_selection_select_all (selection);
+    }
+}
+
+static gboolean
+on_track_list_button_press_event (EtCDDBDialog *self, GdkEventButton *event)
+{
+    g_return_val_if_fail (event != NULL, FALSE);
+
+    if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
+    {
+        /* Double left mouse click */
+        track_list_select_all (self);
+    }
+    return FALSE;
+}
+
+static gboolean
+on_delete_event (EtCDDBDialog *self, GdkEvent *event)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    priv->stop_searching = TRUE;
+    et_cddb_dialog_apply_changes (self);
+
+    gtk_widget_hide (GTK_WIDGET (self));
+
+    /* Stop event propagation. */
+    return TRUE;
+}
+
+static void
+Cddb_Destroy_Window (EtCDDBDialog *self)
+{
+    on_delete_event (self, NULL);
+}
+
+static void
+Cddb_Search_In_All_Fields_Check_Button_Toggled (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    gtk_widget_set_sensitive (priv->search_artist_toggle, 
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle)));
+    gtk_widget_set_sensitive (priv->search_title_toggle, 
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle)));
+    gtk_widget_set_sensitive 
(priv->search_track_toggle,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle)));
+    gtk_widget_set_sensitive (priv->search_other_toggle, 
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle)));
+}
+
+static void
+Cddb_Search_In_All_Categories_Check_Button_Toggled (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    gtk_widget_set_sensitive (priv->categories_blues_toggle, !gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON (priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_classical_toggle, 
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_country_toggle,   
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_folk_toggle,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_jazz_toggle,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_misc_toggle,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_newage_toggle,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_reggae_toggle,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    gtk_widget_set_sensitive(priv->categories_rock_toggle,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+    
gtk_widget_set_sensitive(priv->categories_soundtrack_toggle,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle)));
+}
+
+static void
+Cddb_Set_To_All_Fields_Check_Button_Toggled (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    gtk_widget_set_sensitive(priv->set_title_toggle,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    gtk_widget_set_sensitive(priv->set_artist_toggle,    
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    gtk_widget_set_sensitive(priv->set_album_toggle,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    gtk_widget_set_sensitive(priv->set_year_toggle,      
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    gtk_widget_set_sensitive(priv->set_tracknumber_toggle,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    
gtk_widget_set_sensitive(priv->set_totaltracks_toggle,!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    gtk_widget_set_sensitive(priv->set_genre_toggle,     
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+    gtk_widget_set_sensitive(priv->set_filename_toggle,  
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle)));
+}
+
+static void
+Cddb_Use_Dlm_2_Check_Button_Toggled (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    CDDB_USE_DLM = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_dlm2_toggle));
+}
+
+static void
+create_cddb_dialog (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    GtkWidget *VBox, *vbox, *hbox, *notebookvbox;
+    GtkWidget *Frame;
+    GtkWidget *Table;
+    GtkWidget *Label;
+    GtkWidget *Button;
+    GtkWidget *Separator;
+    GtkWidget *ScrollWindow;
+    GtkWidget *Icon;
+    GtkWidget *combo;
+    GtkWidget *paned;
+    GtkWidget *notebook;
+    gchar *CddbAlbumList_Titles[] = { NULL, N_("Artist / Album"), N_("Category")}; // Note: don't set "" 
instead of NULL else this will cause problem with translation language
+    gchar *CddbTrackList_Titles[] = { "#", N_("Track Name"), N_("Duration")};
+    GtkCellRenderer* renderer;
+    GtkTreeViewColumn* column;
+    GtkTreePath *path;
+    GtkAllocation allocation = { 0,0,0,0 };
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    gtk_window_set_title (GTK_WINDOW (self), _("CDDB Search"));
+
+    g_signal_connect (self, "delete-event", G_CALLBACK (on_delete_event),
+                      NULL);
+
+    VBox = gtk_dialog_get_content_area (GTK_DIALOG (self));
+    gtk_container_set_border_width (GTK_CONTAINER (self), BOX_SPACING);
+
+     /*
+      * Cddb NoteBook
+      */
+    notebook = gtk_notebook_new ();
+    gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook));
+    gtk_box_pack_start (GTK_BOX (VBox), notebook, FALSE, FALSE, 0);
+
+    /*
+     * 1 - Page for automatic search (generate the CDDBId from files)
+     */
+    Label = gtk_label_new(_("Automatic Search"));
+
+    notebookvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
+    gtk_container_set_border_width (GTK_CONTAINER (notebookvbox), BOX_SPACING);
+    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), notebookvbox, Label);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
+    gtk_box_pack_start(GTK_BOX(notebookvbox),hbox,FALSE,FALSE,0);
+
+    Label = gtk_label_new(_("Request CDDB"));
+    gtk_misc_set_alignment(GTK_MISC(Label),1.0,0.5);
+    gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,0);
+
+    // Button to generate CddbId and request string from the selected files
+    Button = gtk_button_new_from_stock (GTK_STOCK_FIND);
+    gtk_box_pack_start (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
+    gtk_widget_set_can_default (Button, TRUE);
+    gtk_widget_grab_default (Button);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (et_cddb_dialog_search_from_selection),
+                              self);
+    gtk_widget_set_tooltip_text(Button,
+                                _("Request automatically the CDDB using the selected files (the order is 
important) to generate the CddbID"));
+
+    // Button to stop the search
+    priv->stop_auto_search_button = Create_Button_With_Icon_And_Label(GTK_STOCK_STOP,NULL);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->stop_auto_search_button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(priv->stop_auto_search_button),GTK_RELIEF_NONE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
+    g_signal_connect_swapped (priv->stop_auto_search_button, "clicked",
+                              G_CALLBACK (stop_search), self);
+    gtk_widget_set_tooltip_text (priv->stop_auto_search_button,
+                                 _("Stop the search"));
+
+    // Separator line
+    Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+    gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
+
+    // Check box to run the scanner
+    priv->use_local_access_toggle = gtk_check_button_new_with_label(_("Use local CDDB"));
+    gtk_box_pack_start(GTK_BOX(hbox),priv->use_local_access_toggle,FALSE,FALSE,0);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->use_local_access_toggle),CDDB_USE_LOCAL_ACCESS);
+    gtk_widget_set_tooltip_text(priv->use_local_access_toggle,_("When activating this option, after loading 
the "
+        "fields, the current selected scanner will be ran (the scanner window must be opened)."));
+
+    // Separator line
+    Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+    gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
+
+    /* Button to quit. */
+    Button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+    gtk_box_pack_end(GTK_BOX(hbox),Button,FALSE,FALSE,0);
+    gtk_widget_set_can_default(Button,TRUE);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Cddb_Destroy_Window), self);
+
+    /*
+     * 2 - Page for manual search
+     */
+    Label = gtk_label_new(_("Manual Search"));
+    notebookvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
+    gtk_notebook_append_page (GTK_NOTEBOOK (notebook), notebookvbox, Label);
+    gtk_container_set_border_width (GTK_CONTAINER (notebookvbox), BOX_SPACING);
+
+    /*
+     * Words to search
+     */
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
+    gtk_box_pack_start(GTK_BOX(notebookvbox),hbox,FALSE,FALSE,0);
+
+    Label = gtk_label_new(_("Words:"));
+    gtk_misc_set_alignment(GTK_MISC(Label),1.0,0.5);
+    gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,0);
+
+    g_assert (priv->search_string_model == NULL);
+    priv->search_string_model = gtk_list_store_new (MISC_COMBO_COUNT,
+                                                G_TYPE_STRING);
+
+    combo = gtk_combo_box_new_with_model_and_entry (GTK_TREE_MODEL (priv->search_string_model));
+    g_object_unref (priv->search_string_model);
+    gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo),
+                                         MISC_COMBO_TEXT);
+    gtk_widget_set_size_request (combo, 220, -1);
+    gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, TRUE, 0);
+    gtk_widget_set_tooltip_text(combo,
+                                _("Enter the words to search (separated by a space or '+')"));
+    /* History List. */
+    Load_Cddb_Search_String_List (priv->search_string_model, MISC_COMBO_TEXT);
+
+    priv->search_string_entry = gtk_bin_get_child (GTK_BIN (combo));
+    g_signal_connect_swapped (priv->search_string_entry, "activate",
+                              G_CALLBACK (Cddb_Search_Album_List_From_String),
+                              self);
+    gtk_entry_set_text (GTK_ENTRY (priv->search_string_entry),"");
+
+    /* Set content of the clipboard if available. */
+    gtk_editable_paste_clipboard (GTK_EDITABLE (priv->search_string_entry));
+
+    // Button to run the search
+    priv->search_button = gtk_button_new_from_stock(GTK_STOCK_FIND);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->search_button,FALSE,FALSE,0);
+    gtk_widget_set_can_default(priv->search_button,TRUE);
+    gtk_widget_grab_default(priv->search_button);
+    g_signal_connect_swapped (priv->search_button, "clicked",
+                              G_CALLBACK (Cddb_Search_Album_List_From_String),
+                              self);
+    g_signal_connect_swapped (GTK_ENTRY (priv->search_string_entry), "changed",
+                              G_CALLBACK (update_search_button_sensitivity),
+                              self);
+
+    /* Button to stop the search. */
+    priv->stop_search_button = Create_Button_With_Icon_And_Label(GTK_STOCK_STOP,NULL);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->stop_search_button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(priv->stop_search_button),GTK_RELIEF_NONE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+    g_signal_connect (priv->stop_search_button, "clicked",
+                      G_CALLBACK (stop_search), self);
+    gtk_widget_set_tooltip_text (priv->stop_search_button, _("Stop the search"));
+
+    /* Button to quit. */
+    Button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+    gtk_box_pack_end(GTK_BOX(hbox),Button,FALSE,FALSE,0);
+    gtk_widget_set_can_default(Button,TRUE);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Cddb_Destroy_Window), self);
+
+    /*
+     * Search options
+     */
+    Frame = gtk_frame_new(_("Search In:"));
+    gtk_box_pack_start(GTK_BOX(notebookvbox),Frame,FALSE,TRUE,0);
+
+    Table = et_grid_new (7,4);
+    gtk_container_add(GTK_CONTAINER(Frame),Table);
+    gtk_grid_set_row_spacing (GTK_GRID (Table), 1);
+    gtk_grid_set_column_spacing (GTK_GRID (Table), 1);
+
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "All fields". */
+    priv->search_all_toggle      = gtk_check_button_new_with_label(_("All Fields"));
+    Separator                  = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Artist". */
+    priv->search_artist_toggle    = gtk_check_button_new_with_label(_("Artist"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Album". */
+    priv->search_title_toggle     = gtk_check_button_new_with_label(_("Album"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Track Name". */
+    priv->search_track_toggle = gtk_check_button_new_with_label(_("Track Name"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Other". */
+    priv->search_other_toggle     = gtk_check_button_new_with_label(_("Other"));
+    gtk_grid_attach (GTK_GRID (Table), priv->search_all_toggle, 0, 0, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), Separator, 1, 0, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->search_artist_toggle, 2, 0, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->search_title_toggle, 3, 0, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->search_track_toggle, 4, 0, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->search_other_toggle, 5, 0, 1, 1);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle), CDDB_SEARCH_IN_ALL_FIELDS);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_artist_toggle), CDDB_SEARCH_IN_ARTIST_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_title_toggle), CDDB_SEARCH_IN_TITLE_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_track_toggle), 
CDDB_SEARCH_IN_TRACK_NAME_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->search_other_toggle), CDDB_SEARCH_IN_OTHER_FIELD);
+    g_signal_connect_swapped (priv->search_all_toggle, "toggled",
+                              G_CALLBACK (Cddb_Search_In_All_Fields_Check_Button_Toggled),
+                              self);
+    g_signal_connect_swapped (priv->search_all_toggle, "toggled",
+                              G_CALLBACK (update_search_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->search_artist_toggle, "toggled",
+                              G_CALLBACK (update_search_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->search_title_toggle, "toggled",
+                              G_CALLBACK (update_search_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->search_track_toggle, "toggled",
+                              G_CALLBACK (update_search_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->search_other_toggle, "toggled",
+                              G_CALLBACK (update_search_button_sensitivity),
+                              self);
+
+    priv->separator_h = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+    gtk_grid_attach (GTK_GRID (Table), priv->separator_h, 0, 1, 6, 1);
+
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "All Categories". */
+    priv->categories_all_toggle      = gtk_check_button_new_with_label(_("All Categories"));
+    priv->separator_v                 = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Blues". */
+    priv->categories_blues_toggle      = gtk_check_button_new_with_label(_("Blues"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Classical". */
+    priv->categories_classical_toggle  = gtk_check_button_new_with_label(_("Classical"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Country". */
+    priv->categories_country_toggle    = gtk_check_button_new_with_label(_("Country"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Folk". */
+    priv->categories_folk_toggle       = gtk_check_button_new_with_label(_("Folk"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Jazz". */
+    priv->categories_jazz_toggle       = gtk_check_button_new_with_label(_("Jazz"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Misc". */
+    priv->categories_misc_toggle       = gtk_check_button_new_with_label(_("Misc."));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "New age". */
+    priv->categories_newage_toggle     = gtk_check_button_new_with_label(_("New Age"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Reggae". */
+    priv->categories_reggae_toggle     = gtk_check_button_new_with_label(_("Reggae"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Rock". */
+    priv->categories_rock_toggle       = gtk_check_button_new_with_label(_("Rock"));
+    /* Translators: This option is for the previous 'search in' option. For
+     * instance, translate this as "Search in:" "Soundtrack". */
+    priv->categories_soundtrack_toggle = gtk_check_button_new_with_label(_("Soundtrack"));
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_all_toggle, 0, 2, 1, 2);
+    gtk_grid_attach (GTK_GRID (Table), priv->separator_v, 1, 2, 1, 2);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_blues_toggle, 2, 2, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_classical_toggle, 3, 2, 1,
+                     1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_country_toggle, 4, 2, 1,
+                     1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_folk_toggle, 5, 2, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_jazz_toggle, 6, 2, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_misc_toggle, 2, 3, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_newage_toggle, 3, 3, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_reggae_toggle, 4, 3, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_rock_toggle, 5, 3, 1, 1);
+    gtk_grid_attach (GTK_GRID (Table), priv->categories_soundtrack_toggle, 6, 3, 1,
+                     1);
+    gtk_label_set_line_wrap(GTK_LABEL(gtk_bin_get_child(GTK_BIN(priv->categories_all_toggle))),TRUE); // 
Wrap label of the check button.
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle),     
CDDB_SEARCH_IN_ALL_CATEGORIES);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_blues_toggle),     
CDDB_SEARCH_IN_BLUES_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_classical_toggle), 
CDDB_SEARCH_IN_CLASSICAL_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_country_toggle),   
CDDB_SEARCH_IN_COUNTRY_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_folk_toggle),      
CDDB_SEARCH_IN_FOLK_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_jazz_toggle),      
CDDB_SEARCH_IN_JAZZ_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_misc_toggle),      
CDDB_SEARCH_IN_MISC_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_newage_toggle),    
CDDB_SEARCH_IN_NEWAGE_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_reggae_toggle),    
CDDB_SEARCH_IN_REGGAE_CATEGORY);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_rock_toggle),      
CDDB_SEARCH_IN_ROCK_CATEGORY);
+    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->categories_soundtrack_toggle),CDDB_SEARCH_IN_SOUNDTRACK_CATEGORY);
+    g_signal_connect_swapped (priv->categories_all_toggle, "toggled",
+                              G_CALLBACK (Cddb_Search_In_All_Categories_Check_Button_Toggled),
+                              self);
+    g_signal_connect_swapped (priv->categories_all_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_blues_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_classical_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_country_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_folk_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_jazz_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_misc_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_newage_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_reggae_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_rock_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    g_signal_connect_swapped (priv->categories_soundtrack_toggle, "toggled",
+                      G_CALLBACK (update_search_button_sensitivity), self);
+    gtk_widget_set_tooltip_text(priv->categories_rock_toggle,_("included: funk, soul, rap, pop, industrial, 
metal, etc."));
+    gtk_widget_set_tooltip_text(priv->categories_soundtrack_toggle,_("movies, shows"));
+    gtk_widget_set_tooltip_text(priv->categories_misc_toggle,_("others that do not fit in the above 
categories"));
+
+    /* Button to display/hide the categories. */
+    priv->show_categories_toggle = gtk_toggle_button_new_with_label (_("Categories"));
+    gtk_grid_attach (GTK_GRID (Table), priv->show_categories_toggle, 6, 0, 1,
+                     1);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->show_categories_toggle),
+                                  CDDB_SHOW_CATEGORIES);
+    g_signal_connect_swapped (priv->show_categories_toggle, "toggled",
+                              G_CALLBACK (on_show_categories_toggle_toggled),
+                              self);
+
+    /*
+     * Results command
+     */
+    Frame = gtk_frame_new(_("Results:"));
+    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,TRUE,0);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
+    gtk_container_add(GTK_CONTAINER(Frame),hbox);
+
+    Label = gtk_label_new(_("Search:"));
+    gtk_misc_set_alignment(GTK_MISC(Label),1.0,0.5);
+    gtk_box_pack_start(GTK_BOX(hbox),Label,FALSE,FALSE,0);
+
+    g_assert (priv->search_string_in_result_model == NULL);
+    priv->search_string_in_result_model = gtk_list_store_new (MISC_COMBO_COUNT,
+                                                        G_TYPE_STRING);
+
+    combo = gtk_combo_box_new_with_model_and_entry (GTK_TREE_MODEL (priv->search_string_in_result_model));
+    g_object_unref (priv->search_string_in_result_model);
+    gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (combo),
+                                         MISC_COMBO_TEXT);
+    gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
+    priv->search_string_in_results_entry = gtk_bin_get_child (GTK_BIN (combo));
+    g_signal_connect_swapped (priv->search_string_in_results_entry,
+                              "activate",
+                              G_CALLBACK (find_next_string_in_results),
+                              self);
+    gtk_widget_set_tooltip_text (priv->search_string_in_results_entry,
+                                 _("Enter the words to search in the list below"));
+
+    /* History List. */
+    Load_Cddb_Search_String_In_Result_List(priv->search_string_in_result_model, MISC_COMBO_TEXT);
+
+    gtk_entry_set_text (GTK_ENTRY (priv->search_string_in_results_entry), "");
+
+    Button = Create_Button_With_Icon_And_Label(GTK_STOCK_GO_DOWN,NULL);
+    gtk_box_pack_start(GTK_BOX(hbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (find_next_string_in_results), self);
+    gtk_widget_set_tooltip_text(Button,_("Search Next"));
+
+    Button = Create_Button_With_Icon_And_Label(GTK_STOCK_GO_UP,NULL);
+    gtk_box_pack_start (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
+    gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (find_previous_string_in_results),
+                              self);
+    gtk_widget_set_tooltip_text (Button, _("Search Previous"));
+
+    // Separator line
+    Separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+    gtk_box_pack_start(GTK_BOX(hbox),Separator,FALSE,FALSE,0);
+
+    priv->display_red_lines_toggle = gtk_toggle_button_new();
+    Icon = gtk_image_new_from_stock("easytag-red-lines", GTK_ICON_SIZE_BUTTON);
+    gtk_container_add(GTK_CONTAINER(priv->display_red_lines_toggle),Icon);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->display_red_lines_toggle,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(priv->display_red_lines_toggle),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(priv->display_red_lines_toggle,_("Show only red lines (or show all lines) in 
the 'Artist / Album' list"));
+    g_signal_connect_swapped (priv->display_red_lines_toggle, "toggled",
+                              G_CALLBACK (Cddb_Display_Red_Lines_In_Result),
+                              self);
+
+    Button = Create_Button_With_Icon_And_Label ("easytag-unselect-all", NULL);
+    gtk_box_pack_end (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
+    gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text (Button, _("Unselect all lines"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (track_list_unselect_all), self);
+
+    Button = Create_Button_With_Icon_And_Label ("easytag-invert-selection",
+                                                NULL);
+    gtk_box_pack_end (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
+    gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text (Button, _("Invert lines selection"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Cddb_Track_List_Invert_Selection),
+                              self);
+
+    Button = gtk_button_new ();
+    gtk_container_add (GTK_CONTAINER (Button),
+                       gtk_image_new_from_stock (GTK_STOCK_SELECT_ALL,
+                                                 GTK_ICON_SIZE_BUTTON));
+    gtk_box_pack_end (GTK_BOX (hbox), Button, FALSE, FALSE, 0);
+    gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text (Button, _("Select all lines"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (track_list_select_all), self);
+
+    /*
+     * Result of search
+     */
+    paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
+    gtk_box_pack_start (GTK_BOX (VBox), paned, TRUE, TRUE, 0);
+
+    /* List of albums. */
+    ScrollWindow = gtk_scrolled_window_new(NULL, NULL);
+    
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindow),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
+    gtk_widget_set_size_request(GTK_WIDGET(ScrollWindow),-1,100);
+    gtk_paned_pack1 (GTK_PANED (paned), ScrollWindow, TRUE, FALSE);
+
+    priv->album_list_model = gtk_list_store_new(CDDB_ALBUM_LIST_COUNT,
+                                            GDK_TYPE_PIXBUF,
+                                            G_TYPE_STRING,
+                                            G_TYPE_STRING,
+                                            G_TYPE_POINTER,
+                                            PANGO_TYPE_STYLE,
+                                            G_TYPE_INT,
+                                            GDK_TYPE_RGBA);
+    priv->album_list_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->album_list_model));
+    g_object_unref (priv->album_list_model);
+
+    renderer = gtk_cell_renderer_pixbuf_new();
+    column = gtk_tree_view_column_new_with_attributes(_(CddbAlbumList_Titles[0]), renderer,
+                                                      "pixbuf",         CDDB_ALBUM_LIST_PIXBUF,
+                                                      NULL);
+    gtk_tree_view_column_set_resizable(column, FALSE);
+    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->album_list_view), column);
+
+    renderer = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new_with_attributes(_(CddbAlbumList_Titles[1]), renderer,
+                                                      "text",           CDDB_ALBUM_LIST_ALBUM,
+                                                      "weight",         CDDB_ALBUM_LIST_FONT_WEIGHT,
+                                                      "style",          CDDB_ALBUM_LIST_FONT_STYLE,
+                                                      "foreground-rgba", CDDB_ALBUM_LIST_FOREGROUND_COLOR,
+                                                      NULL);
+    gtk_tree_view_column_set_resizable(column, TRUE);
+    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->album_list_view), column);
+
+    renderer = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new_with_attributes(_(CddbAlbumList_Titles[2]), renderer,
+                                                      "text",           CDDB_ALBUM_LIST_CATEGORY,
+                                                      "weight",         CDDB_ALBUM_LIST_FONT_WEIGHT,
+                                                      "style",          CDDB_ALBUM_LIST_FONT_STYLE,
+                                                      "foreground-rgba", CDDB_ALBUM_LIST_FOREGROUND_COLOR,
+                                                      NULL);
+    gtk_tree_view_column_set_resizable(column, TRUE);
+    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->album_list_view), column);
+    //gtk_tree_view_columns_autosize(GTK_TREE_VIEW(priv->album_list_view));
+
+    gtk_container_add(GTK_CONTAINER(ScrollWindow), priv->album_list_view);
+
+    path = gtk_tree_path_new_first ();
+    gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->album_list_view), path, NULL,
+                              FALSE);
+    gtk_tree_path_free (path);
+    g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->album_list_view)),
+                              "changed", G_CALLBACK (show_album_info), self);
+    g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->album_list_view)),
+                              "changed",
+                              G_CALLBACK (Cddb_Get_Album_Tracks_List_CB),
+                              self);
+
+    // List of tracks
+    ScrollWindow = gtk_scrolled_window_new(NULL,NULL);
+    
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(ScrollWindow),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
+
+
+    gtk_widget_set_size_request(GTK_WIDGET(ScrollWindow), -1, 100);
+    gtk_paned_pack2 (GTK_PANED (paned), ScrollWindow, TRUE, FALSE);
+
+    priv->track_list_model = gtk_list_store_new(CDDB_TRACK_LIST_COUNT,
+                                            G_TYPE_UINT,
+                                            G_TYPE_STRING,
+                                            G_TYPE_STRING,
+                                            G_TYPE_POINTER,
+                                            G_TYPE_POINTER);
+    priv->track_list_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(priv->track_list_model));
+    g_object_unref (priv->track_list_model);
+    renderer = gtk_cell_renderer_text_new();
+    g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); // Align to the right
+    column = gtk_tree_view_column_new_with_attributes(_(CddbTrackList_Titles[0]), renderer,
+                                                      "text", CDDB_TRACK_LIST_NUMBER, NULL);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->track_list_view), column);
+    gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(priv->track_list_model), SORT_LIST_NUMBER,
+                                    Cddb_Track_List_Sort_Func, GINT_TO_POINTER(SORT_LIST_NUMBER), NULL);
+    gtk_tree_view_column_set_sort_column_id(column, SORT_LIST_NUMBER);
+    renderer = gtk_cell_renderer_text_new();
+    column = gtk_tree_view_column_new_with_attributes(_(CddbTrackList_Titles[1]), renderer,
+                                                      "text", CDDB_TRACK_LIST_NAME, NULL);
+    gtk_tree_view_column_set_resizable(column, TRUE);
+    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->track_list_view), column);
+    gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(priv->track_list_model), SORT_LIST_NAME,
+                                    Cddb_Track_List_Sort_Func, GINT_TO_POINTER(SORT_LIST_NAME), NULL);
+    gtk_tree_view_column_set_sort_column_id(column, SORT_LIST_NAME);
+
+    renderer = gtk_cell_renderer_text_new();
+    g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL); // Align to the right
+    column = gtk_tree_view_column_new_with_attributes(_(CddbTrackList_Titles[2]), renderer,
+                                                      "text", CDDB_TRACK_LIST_TIME, NULL);
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->track_list_view), column);
+
+    //gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(priv->track_list_model), SORT_LIST_NUMBER, 
GTK_SORT_ASCENDING);
+    gtk_tree_view_set_reorderable(GTK_TREE_VIEW(priv->track_list_view), TRUE);
+
+    gtk_container_add(GTK_CONTAINER(ScrollWindow),priv->track_list_view);
+    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->track_list_view)),
+                                GTK_SELECTION_MULTIPLE);
+    g_signal_connect_swapped (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->track_list_view)),
+                              "changed",
+                              G_CALLBACK (Cddb_Track_List_Row_Selected), self);
+    g_signal_connect_swapped (priv->track_list_view, "button-press-event",
+                              G_CALLBACK (on_track_list_button_press_event),
+                              self);
+    gtk_widget_set_tooltip_text(priv->track_list_view, _("Select lines to 'apply' to "
+        "your files list. All lines will be processed if no line is selected.\n"
+        "You can also reorder lines in this list before using 'apply' button."));
+
+    /*
+     * Apply results to fields...
+     */
+    Frame = gtk_frame_new(_("Set Into:"));
+    gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,TRUE,0);
+
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
+    gtk_container_add(GTK_CONTAINER(Frame),vbox);
+
+    priv->set_all_toggle  = gtk_check_button_new_with_label(_("All"));
+    Separator           = gtk_separator_new(GTK_ORIENTATION_VERTICAL);
+    priv->set_filename_toggle   = gtk_check_button_new_with_label(_("Filename"));
+    priv->set_title_toggle      = gtk_check_button_new_with_label(_("Title"));
+    priv->set_artist_toggle     = gtk_check_button_new_with_label(_("Artist"));
+    priv->set_album_toggle      = gtk_check_button_new_with_label(_("Album"));
+    priv->set_year_toggle       = gtk_check_button_new_with_label(_("Year"));
+    priv->set_tracknumber_toggle = gtk_check_button_new_with_label(_("Track #"));
+    priv->set_totaltracks_toggle = gtk_check_button_new_with_label(_("# Tracks"));
+    priv->set_genre_toggle      = gtk_check_button_new_with_label(_("Genre"));
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
+    gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_all_toggle, FALSE,FALSE,0);
+    gtk_box_pack_start(GTK_BOX(hbox),Separator,          FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_filename_toggle,  FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_title_toggle,     FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_artist_toggle,    FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_album_toggle,     FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_year_toggle,      FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_tracknumber_toggle,     FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_totaltracks_toggle,FALSE,FALSE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->set_genre_toggle,     FALSE,FALSE,2);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle), CDDB_SET_TO_ALL_FIELDS);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_title_toggle),     CDDB_SET_TO_TITLE);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_artist_toggle),    CDDB_SET_TO_ARTIST);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_album_toggle),     CDDB_SET_TO_ALBUM);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_year_toggle),      CDDB_SET_TO_YEAR);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_tracknumber_toggle),     CDDB_SET_TO_TRACK);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_totaltracks_toggle),CDDB_SET_TO_TRACK_TOTAL);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_genre_toggle),     CDDB_SET_TO_GENRE);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->set_filename_toggle),  CDDB_SET_TO_FILE_NAME);
+    g_signal_connect_swapped (priv->set_all_toggle, "toggled",
+                              G_CALLBACK (Cddb_Set_To_All_Fields_Check_Button_Toggled),
+                              self);
+    g_signal_connect_swapped (priv->set_all_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_title_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_artist_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_album_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_year_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_tracknumber_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_totaltracks_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_genre_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+    g_signal_connect_swapped (priv->set_filename_toggle, "toggled",
+                              G_CALLBACK(update_apply_button_sensitivity),
+                              self);
+
+    hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
+    gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
+
+    // Check box to run the scanner
+    priv->run_scanner_toggle = gtk_check_button_new_with_label(_("Run the current scanner for each file"));
+    gtk_box_pack_start(GTK_BOX(hbox),priv->run_scanner_toggle,FALSE,TRUE,0);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->run_scanner_toggle),CDDB_RUN_SCANNER);
+    gtk_widget_set_tooltip_text(priv->run_scanner_toggle,_("When activating this option, after loading the "
+        "fields, the current selected scanner will be ran (the scanner window must be opened)."));
+
+    // Check box to use DLM (also used in the preferences window)
+    priv->use_dlm2_toggle = gtk_check_button_new_with_label(_("Match lines with the Levenshtein algorithm"));
+    gtk_box_pack_start(GTK_BOX(hbox),priv->use_dlm2_toggle,FALSE,FALSE,0);
+    // Doesn't activate it by default because if the new user don't pay attention to it,
+    // it will not understand why the cddb results aren't loaded correctly...
+    //gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->use_dlm2_toggle),CDDB_USE_DLM);
+    gtk_widget_set_tooltip_text(priv->use_dlm2_toggle,_("When activating this option, the "
+        "Levenshtein algorithm (DLM: Damerau-Levenshtein Metric) will be used "
+        "to match the CDDB title against every filename in the current folder, "
+        "and to select the best match. This will be used when selecting the "
+        "corresponding audio file, or applying CDDB results, instead of using "
+        "directly the position order."));
+    g_signal_connect_swapped (priv->use_dlm2_toggle, "toggled",
+                              G_CALLBACK (Cddb_Use_Dlm_2_Check_Button_Toggled),
+                              self);
+
+    /* Button to apply. */
+    priv->apply_button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
+    gtk_box_pack_end(GTK_BOX(hbox),priv->apply_button,FALSE,FALSE,0);
+    g_signal_connect_swapped (priv->apply_button, "clicked",
+                              G_CALLBACK (Cddb_Set_Track_Infos_To_File_List),
+                              self);
+    gtk_widget_set_tooltip_text(priv->apply_button,_("Load the selected lines or all lines (if no line 
selected)."));
+
+    /*
+     * Status bar
+     */
+    priv->status_bar = gtk_statusbar_new();
+    gtk_box_pack_start(GTK_BOX(VBox),priv->status_bar,FALSE,TRUE,0);
+    gtk_widget_set_size_request(priv->status_bar, 300, -1);
+    priv->status_bar_context = gtk_statusbar_get_context_id(GTK_STATUSBAR(priv->status_bar),"Messages");
+    gtk_statusbar_push (GTK_STATUSBAR (priv->status_bar), priv->status_bar_context,
+                        _("Ready to search"));
+
+    g_signal_emit_by_name (priv->search_string_entry, "changed");
+    g_signal_emit_by_name (priv->search_all_toggle, "toggled");
+    g_signal_emit_by_name (priv->categories_all_toggle, "toggled");
+    g_signal_emit_by_name (priv->set_all_toggle, "toggled");
+    priv->stop_searching = FALSE;
+
+    /* Force resize window. */
+    gtk_widget_get_allocation(GTK_WIDGET(priv->categories_all_toggle), &allocation);
+    gtk_widget_set_size_request(GTK_WIDGET(priv->search_all_toggle), allocation.width, -1);
+    g_signal_emit_by_name (priv->show_categories_toggle, "toggled");
+}
+
+/*
+ * For the configuration file...
+ */
+void
+et_cddb_dialog_apply_changes (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    g_return_if_fail (ET_CDDB_DIALOG (self));
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    CDDB_SEARCH_IN_ALL_FIELDS       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_all_toggle));
+    CDDB_SEARCH_IN_ARTIST_FIELD     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_artist_toggle));
+    CDDB_SEARCH_IN_TITLE_FIELD      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_title_toggle));
+    CDDB_SEARCH_IN_TRACK_NAME_FIELD = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_track_toggle));
+    CDDB_SEARCH_IN_OTHER_FIELD      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->search_other_toggle));
+    CDDB_SHOW_CATEGORIES            = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->show_categories_toggle));
+
+    CDDB_SEARCH_IN_ALL_CATEGORIES      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_all_toggle));
+    CDDB_SEARCH_IN_BLUES_CATEGORY      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_blues_toggle));
+    CDDB_SEARCH_IN_CLASSICAL_CATEGORY  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_classical_toggle));
+    CDDB_SEARCH_IN_COUNTRY_CATEGORY    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_country_toggle));
+    CDDB_SEARCH_IN_FOLK_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_folk_toggle));
+    CDDB_SEARCH_IN_JAZZ_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_jazz_toggle));
+    CDDB_SEARCH_IN_MISC_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_misc_toggle));
+    CDDB_SEARCH_IN_NEWAGE_CATEGORY     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_newage_toggle));
+    CDDB_SEARCH_IN_REGGAE_CATEGORY     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_reggae_toggle));
+    CDDB_SEARCH_IN_ROCK_CATEGORY       = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_rock_toggle));
+    CDDB_SEARCH_IN_SOUNDTRACK_CATEGORY = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->categories_soundtrack_toggle));
+
+    CDDB_SET_TO_ALL_FIELDS  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_all_toggle));
+    CDDB_SET_TO_TITLE       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_title_toggle));
+    CDDB_SET_TO_ARTIST      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_artist_toggle));
+    CDDB_SET_TO_ALBUM       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_album_toggle));
+    CDDB_SET_TO_YEAR        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_year_toggle));
+    CDDB_SET_TO_TRACK       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_tracknumber_toggle));
+    CDDB_SET_TO_TRACK_TOTAL = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_totaltracks_toggle));
+    CDDB_SET_TO_GENRE       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_genre_toggle));
+    CDDB_SET_TO_FILE_NAME   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->set_filename_toggle));
+
+    CDDB_RUN_SCANNER        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->run_scanner_toggle));
+    CDDB_USE_DLM            = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->use_dlm2_toggle));
+    CDDB_USE_LOCAL_ACCESS   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->use_local_access_toggle));
+
+    /* Save combobox history lists before exit. */
+    Save_Cddb_Search_String_List(priv->search_string_model, MISC_COMBO_TEXT);
+    Save_Cddb_Search_String_In_Result_List(priv->search_string_in_result_model, MISC_COMBO_TEXT);
+}
+
+/*
+ * Sort the track list
+ */
+static gint
+Cddb_Track_List_Sort_Func (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b,
+                           gpointer data)
+{
+    gint sortcol = GPOINTER_TO_INT(data);
+    gchar *text1, *text1cp;
+    gchar *text2, *text2cp;
+    gint num1;
+    gint num2;
+    gint ret = 0;
+
+    switch (sortcol)
+    {
+        case SORT_LIST_NUMBER:
+            gtk_tree_model_get(model, a, CDDB_TRACK_LIST_NUMBER, &num1, -1);
+            gtk_tree_model_get(model, b, CDDB_TRACK_LIST_NUMBER, &num2, -1);
+            if (num1 < num2)
+                return -1;
+            else if(num1 > num2)
+                return 1;
+            else
+                return 0;
+            break;
+
+        case SORT_LIST_NAME:
+            gtk_tree_model_get(model, a, CDDB_TRACK_LIST_NAME, &text1, -1);
+            gtk_tree_model_get(model, b, CDDB_TRACK_LIST_NAME, &text2, -1);
+            text1cp = g_utf8_collate_key_for_filename(text1, -1);
+            text2cp = g_utf8_collate_key_for_filename(text2, -1);
+            // Must be the same rules as "ET_Comp_Func_Sort_File_By_Ascending_Filename" to be
+            // able to sort in the same order files in cddb and in the file list.
+            ret = SORTING_FILE_CASE_SENSITIVE ? strcmp(text1cp,text2cp) : strcasecmp(text1cp,text2cp);
+
+            g_free(text1);
+            g_free(text2);
+            g_free(text1cp);
+            g_free(text2cp);
+            break;
+    }
+
+    return ret;
+}
+
+/*
+ * Read one line (of the connection) into cddb_out.
+ * return  : -1 on error
+ *            0 if no more line to read (EOF)
+ *            1 if more lines to read
+ *
+ * Server answser is formated like this :
+ *
+ * HTTP/1.1 200 OK\r\n                              }
+ * Server: Apache/1.3.19 (Unix) PHP/4.0.4pl1\r\n    } "Header"
+ * Connection: close\r\n                            }
+ * \r\n
+ * <html>\n                                         }
+ * [...]                                            } "Body"
+ */
+static gint
+Cddb_Read_Line (FILE **file, gchar **cddb_out)
+{
+    gchar  buffer[MAX_STRING_LEN];
+    gchar *result;
+    size_t l;
+
+    if (*file == NULL)
+    {
+        // Open the file for reading the first time
+        gchar *file_path;
+
+        file_path = g_build_filename (g_get_user_cache_dir (), PACKAGE_TARNAME,
+                                      CDDB_RESULT_FILE, NULL);
+
+        if ((*file = fopen (file_path, "r")) == 0)
+        {
+            Log_Print (LOG_ERROR, _("Cannot open file '%s' (%s)"), file_path,
+                       g_strerror(errno));
+            g_free (file_path);
+            return -1; // Error!
+        }
+        g_free (file_path);
+    }
+
+    result = fgets(buffer,sizeof(buffer),*file);
+    if (result != NULL)
+    {
+       l = strlen(buffer);
+        if (l > 0 && buffer[l-1] == '\n')
+            buffer[l-1] = '\0';
+
+       // Many '\r' chars may be present
+        while ((l = strlen(buffer)) > 0 && buffer[l-1] == '\r')
+            buffer[l-1] = '\0';
+
+        *cddb_out = g_strdup(buffer);
+    }else
+    {
+        // On error, or EOF
+        fclose(*file);
+        *file = NULL;
+
+        //*cddb_out = NULL;
+        *cddb_out = g_strdup(""); // To avoid a crash
+
+        return 0;
+    }
+
+    //g_print("Line read: %s\n",*cddb_out);
+    return 1;
+}
+
+
+/*
+ * Read HTTP header data : from "HTTP/1.1 200 OK" to the blank line
+ */
+static gint
+Cddb_Read_Http_Header (FILE **file, gchar **cddb_out)
+{
+
+    // The 'file' is opened (if no error) in this function
+    if ( Cddb_Read_Line(file,cddb_out) < 0 )
+        return -1; // Error!
+
+    // First line must be : "HTTP/1.1 200 OK"
+    if ( !*cddb_out || strncmp("HTTP",*cddb_out,4)!=0 || strstr(*cddb_out,"200 OK")==NULL )
+        return -1;
+
+    /* Read until end of the HTTP header up to the next blank line. */
+    do
+    {
+        g_free (*cddb_out);
+    }
+    while (Cddb_Read_Line (file, cddb_out) > 0
+           && *cddb_out && strlen (*cddb_out) > 0);
+
+    //g_print("Http Header : %s\n",*cddb_out);
+    return 1;
+}
+
+/*
+ * Read CDDB header data when requesting a file (cmd=cddb+read+<album genre>+<discid>)
+ * Must be read after the HTTP header :
+ *
+ *      HTTP/1.1 200 OK
+ *      Date: Sun, 26 Nov 2006 22:37:13 GMT
+ *      Server: Apache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5 PHP/4.3.10-16 proxy_html/2.4 
mod_perl/1.999.21 Perl/v5.8.4
+ *      Expires: Sun Nov 26 23:37:14 2006
+ *      Content-Length: 1013
+ *      Connection: close
+ *      Content-Type: text/plain; charset=UTF-8
+ *
+ *      210 newage 710ed208 CD database entry follows (until terminating `.')
+ *
+ * Cddb Header is the line like this :
+ *      210 newage 710ed208 CD database entry follows (until terminating `.')
+ */
+static gint
+Cddb_Read_Cddb_Header (FILE **file, gchar **cddb_out)
+{
+    if ( Cddb_Read_Line(file,cddb_out) < 0 )
+        return -1; // Error!
+
+    // Some requests receive some strange data (arbitrary : less than 10 chars.)
+    // at the beginning (2 or 3 characters)... So we read one line more...
+    if ( !*cddb_out || strlen(*cddb_out) < 10 )
+        if ( Cddb_Read_Line(file,cddb_out) < 0 )
+            return -1; // Error!
+
+    //g_print("Cddb Header : %s\n",*cddb_out);
+
+    // Read the line
+    // 200 - exact match
+    // 210 - multiple exact matches
+    // 211 - inexact match
+    if ( *cddb_out == NULL
+    || (strncmp(*cddb_out,"200",3)!=0
+    &&  strncmp(*cddb_out,"210",3)!=0
+    &&  strncmp(*cddb_out,"211",3)!=0) )
+        return -1;
+
+    return 1;
+}
+
+
+
+static gboolean
+Cddb_Free_Track_Album_List (GList *track_list)
+{
+    GList *l;
+
+    g_return_val_if_fail (track_list != NULL, FALSE);
+
+    track_list = g_list_first (track_list);
+
+    for (l = track_list; l != NULL; l = g_list_next (l))
+    {
+        CddbTrackAlbum *cddbtrackalbum = l->data;
+        if (cddbtrackalbum)
+        {
+            g_free(cddbtrackalbum->track_name);
+            g_free(cddbtrackalbum);
+            cddbtrackalbum = NULL;
+        }
+    }
+
+    g_list_free (track_list);
+
+    return TRUE;
+}
 
 /*
  * Send cddb query using the CddbId generated from the selected files to get the
  * list of albums matching with this cddbid.
  */
-static gboolean
-Cddb_Search_Album_From_Selected_Files (void)
+gboolean
+et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     gint   socket_id;
     gint   bytes_written;
     gulong bytes_read_total = 0;
@@ -2968,6 +3875,8 @@ Cddb_Search_Album_From_Selected_Files (void)
 
     g_return_val_if_fail (BrowserList != NULL, FALSE);
 
+    priv = et_cddb_dialog_get_instance_private (self);
+
     // Number of selected files
     fileListModel = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(BrowserList)));
     file_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
@@ -3007,7 +3916,7 @@ Cddb_Search_Album_From_Selected_Files (void)
     if (file_selectedcount == 0)
     {
         msg = g_strdup_printf(_("No file selected"));
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
         g_free(msg);
         return TRUE;
     }else if (file_selectedcount > 99)
@@ -3015,13 +3924,13 @@ Cddb_Search_Album_From_Selected_Files (void)
         // The CD redbook standard defines the maximum number of tracks as 99, any
         // queries with more than 99 tracks will never return a result.
         msg = g_strdup_printf(_("More than 99 files selected. Cannot send request"));
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
         g_free(msg);
         return FALSE;
     }else
     {
         msg = g_strdup_printf(ngettext("One file selected","%d files 
selected",file_selectedcount),file_selectedcount);
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
         g_free(msg);
     }
 
@@ -3063,19 +3972,18 @@ Cddb_Search_Album_From_Selected_Files (void)
 
 
     /* Delete previous album list. */
-    cddb_album_model_clear ();
-    cddb_track_model_clear ();
+    cddb_album_model_clear (self);
+    cddb_track_model_clear (self);
 
-    if (CddbAlbumList)
+    if (priv->album_list)
     {
-        Cddb_Free_Album_List();
-        CddbAlbumList = NULL;
+        Cddb_Free_Album_List (self);
     }
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),TRUE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),TRUE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),TRUE);
+    gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),TRUE);
 
 
-    CDDB_USE_LOCAL_ACCESS = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseLocalAccess));
+    CDDB_USE_LOCAL_ACCESS = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->use_local_access_toggle));
     if (CDDB_USE_LOCAL_ACCESS) // Remote or Local acces?
     {
         /*
@@ -3099,7 +4007,7 @@ Cddb_Search_Album_From_Selected_Files (void)
             {
                 GtkWidget *msgdialog;
 
-                msgdialog = gtk_message_dialog_new(GTK_WINDOW(CddbWindow),
+                msgdialog = gtk_message_dialog_new(GTK_WINDOW(self),
                                                    GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                                    GTK_MESSAGE_ERROR,
                                                    GTK_BUTTONS_CLOSE,
@@ -3139,7 +4047,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                 // Get album ID
                 cddbalbum->id = Try_To_Validate_Utf8_String(cddb_discid);
 
-                while ( CddbWindow && !CddbStopSearch
+                while ( self && !priv->stop_searching
                 && (rc = Cddb_Read_Line(&file,&cddb_out)) > 0 )
                 {
                     if (!cddb_out) // Empty line?
@@ -3177,7 +4085,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                     g_free(cddb_out);
                 }
 
-                CddbAlbumList = g_list_append(CddbAlbumList,cddbalbum);
+                priv->album_list = g_list_append(priv->album_list,cddbalbum);
 
                 // Need to close it, if not done in Cddb_Read_Line
                 if (file)
@@ -3220,9 +4128,10 @@ Cddb_Search_Album_From_Selected_Files (void)
             if (!cddb_server_name || strcmp(cddb_server_name,"")==0)
                 continue;
 
-            // Connection to the server
-            if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
-                                                 CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
+            /* Connection to the server. */
+            if ((socket_id = Cddb_Open_Connection (self,
+                                                   CDDB_USE_PROXY ? CDDB_PROXY_NAME : cddb_server_name,
+                                                   CDDB_USE_PROXY ? CDDB_PROXY_PORT : cddb_server_port)) <= 
0)
             {
                 g_free(cddb_in);
                 g_free(cddb_server_name);
@@ -3256,7 +4165,7 @@ Cddb_Search_Album_From_Selected_Files (void)
 
             msg = g_strdup_printf(_("Sending request (CddbId: %s, #tracks: %d, Disc length: %d)…"),
                                 cddb_discid,num_tracks,disc_length);
-            gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+            gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
             g_free(msg);
 
             while (gtk_events_pending())
@@ -3265,10 +4174,10 @@ Cddb_Search_Album_From_Selected_Files (void)
             if ( (bytes_written=send(socket_id,cddb_in,strlen(cddb_in)+1,0)) < 0)
             {
                 Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
-                Cddb_Close_Connection(socket_id);
-                g_free(cddb_in);
-                g_free(cddb_server_name);
-                g_free(cddb_server_cgi_path);
+                Cddb_Close_Connection (self, socket_id);
+                g_free (cddb_in);
+                g_free (cddb_server_name);
+                g_free (cddb_server_cgi_path);
                 return FALSE;
             }
             g_free(cddb_in);
@@ -3278,21 +4187,21 @@ Cddb_Search_Album_From_Selected_Files (void)
             /*
              * Read the answer
              */
-            gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Receiving data…"));
+            gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,_("Receiving 
data…"));
             while (gtk_events_pending())
                 gtk_main_iteration();
 
-            // Write result in a file
-            if (Cddb_Write_Result_To_File(socket_id,&bytes_read_total) < 0)
+            /* Write result in a file. */
+            if (Cddb_Write_Result_To_File (self, socket_id, &bytes_read_total) < 0)
             {
                 msg = g_strdup(_("The server returned a bad response"));
-                gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+                gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
                 Log_Print(LOG_ERROR,"%s",msg);
                 g_free(msg);
                 g_free(cddb_server_name);
                 g_free(cddb_server_cgi_path);
-                gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-                gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+                gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+                gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
                 return FALSE;
             }
 
@@ -3301,14 +4210,14 @@ Cddb_Search_Album_From_Selected_Files (void)
             if (Cddb_Read_Http_Header(&file,&cddb_out) <= 0 || !cddb_out) // Order is important!
             {
                 msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
-                gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+                gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
                 Log_Print(LOG_ERROR,"%s",msg);
                 g_free(msg);
                 g_free(cddb_out);
                 g_free(cddb_server_name);
                 g_free(cddb_server_cgi_path);
-                gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-                gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
+                gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_search_button),FALSE);
+                gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
                 if (file)
                     fclose(file);
                 return FALSE;
@@ -3327,7 +4236,7 @@ Cddb_Search_Album_From_Selected_Files (void)
              * For MusicBrainz Cddb Gateway (see http://wiki.musicbrainz.org/CddbGateway), the lines to read 
are like :
              *      200 jazz 7e0a100a Pink Floyd / Dark Side of the Moon
              */
-            while ( CddbWindow && !CddbStopSearch
+            while ( self && !priv->stop_searching
             && Cddb_Read_Line(&file,&cddb_out) > 0 )
             {
                 cddb_out_tmp = cddb_out;
@@ -3389,7 +4298,7 @@ Cddb_Search_Album_From_Selected_Files (void)
                     // Get album and artist names.
                     cddbalbum->artist_album = Try_To_Validate_Utf8_String(cddb_out_tmp);
 
-                    CddbAlbumList = g_list_append(CddbAlbumList,cddbalbum);
+                    priv->album_list = g_list_append(priv->album_list,cddbalbum);
                 }
 
                 g_free(cddb_out);
@@ -3398,879 +4307,41 @@ Cddb_Search_Album_From_Selected_Files (void)
             g_free(cddb_server_name);
             g_free(cddb_server_cgi_path);
 
-            // Close file opened for reading lines
+            /* Close file opened for reading lines. */
             if (file)
             {
                 fclose(file);
                 file = NULL;
             }
 
-            // Close connection
-            Cddb_Close_Connection(socket_id);
+            /* Close connection. */
+            Cddb_Close_Connection (self, socket_id);
         }
 
     }
 
-    msg = g_strdup_printf(ngettext("DiscID '%s' gave one matching album","DiscID '%s' gave %d matching 
albums",g_list_length(CddbAlbumList)),cddb_discid,g_list_length(CddbAlbumList));
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
+    msg = g_strdup_printf(ngettext("DiscID '%s' gave one matching album","DiscID '%s' gave %d matching 
albums",g_list_length(priv->album_list)),cddb_discid,g_list_length(priv->album_list));
+    gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
     g_free(msg);
 
     g_free(cddb_discid);
     g_free(query_string);
 
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
-
-    // Initialize the button
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(CddbDisplayRedLinesButton), FALSE);
-
-    // Load the albums found in the list
-    Cddb_Load_Album_List(FALSE);
-
-    return TRUE;
-}
-
-
-/*
- * Callback when selecting a row in the Album List.
- * We get the list of tracks of the selected album
- */
-static gboolean
-Cddb_Get_Album_Tracks_List_CB (GtkTreeSelection *selection, gpointer data)
-{
-    gint i;
-    gint i_max = 5;
-
-    /* As may be not opened the first time (The server returned a wrong answer!)
-     * me try to reconnect severals times */
-    for (i = 1; i <= i_max; i++)
-    {
-        if ( Cddb_Get_Album_Tracks_List(selection) == TRUE )
-        {
-            break;
-        }
-    }
-    if (i <= i_max)
-    {
-        return TRUE;
-    } else
-    {
-        return FALSE;
-    }
-}
-
-/*
- * Look up a specific album in freedb, and save to a CddbAlbum structure
- */
-static gboolean
-Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
-{
-    gint       socket_id = 0;
-    CddbAlbum *cddbalbum = NULL;
-    GList     *TrackOffsetList = NULL;
-    gchar     *cddb_in, *cddb_out = NULL;
-    gchar     *cddb_end_str, *msg, *copy, *valid;
-    gchar     *proxy_auth;
-    gchar     *cddb_server_name;
-    gint       cddb_server_port;
-    gchar     *cddb_server_cgi_path;
-    gint       bytes_written;
-    gulong     bytes_read_total = 0;
-    FILE      *file = NULL;
-    gboolean   read_track_offset = FALSE;
-    GtkTreeIter row;
-
-    g_return_val_if_fail (CddbWindow != NULL, FALSE);
-
-    cddb_track_model_clear ();
-    Cddb_Set_Apply_Button_Sensitivity ();
-
-    if (gtk_tree_selection_get_selected(selection, NULL, &row))
-    {
-        gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), &row, CDDB_ALBUM_LIST_DATA, &cddbalbum, -1);
-    }
-    if (!cddbalbum)
-        return FALSE;
-
-    // We have already the track list
-    if (cddbalbum->track_list != NULL)
-    {
-        Cddb_Load_Track_Album_List(cddbalbum->track_list);
-        return TRUE;
-    }
-
-    // Parameters of the server used
-    cddb_server_name     = cddbalbum->server_name;
-    cddb_server_port     = cddbalbum->server_port;
-    cddb_server_cgi_path = cddbalbum->server_cgi_path;
-
-    if (!cddb_server_name)
-    {
-        // Local access
-        if ( (file=fopen(cddb_server_cgi_path,"r"))==0 )
-        {
-            Log_Print(LOG_ERROR,_("Can't load file: '%s' (%s)."),cddb_server_cgi_path,g_strerror(errno));
-            return FALSE;
-        }
-
-    }else
-    {
-        // Remote access
-
-        // Connection to the server
-        if ( (socket_id=Cddb_Open_Connection(CDDB_USE_PROXY?CDDB_PROXY_NAME:cddb_server_name,
-                                             CDDB_USE_PROXY?CDDB_PROXY_PORT:cddb_server_port)) <= 0 )
-            return FALSE;
-
-               if ( strstr(cddb_server_name,"gnudb") != NULL )
-               {
-                       // For gnudb
-                       // New version of gnudb doesn't use a cddb request, but a http request
-                   cddb_in = g_strdup_printf("GET %s%s/gnudb/"
-                                             "%s/%s"
-                                             " HTTP/1.1\r\n"
-                                             "Host: %s:%d\r\n"
-                                             "User-Agent: %s %s\r\n"
-                                             "%s"
-                                             "Connection: close\r\n"
-                                             "\r\n",
-                                             CDDB_USE_PROXY?"http://":"";, 
CDDB_USE_PROXY?cddb_server_name:"",  // Needed when using proxy
-                                             cddbalbum->category,cddbalbum->id,
-                                             cddb_server_name,cddb_server_port,
-                                             PACKAGE_NAME, PACKAGE_VERSION,
-                                             (proxy_auth=Cddb_Format_Proxy_Authentification())
-                                             );
-               }else
-               {
-                   // CDDB Request (ex: GET 
/~cddb/cddb.cgi?cmd=cddb+read+jazz+0200a401&hello=noname+localhost+EasyTAG+0.31&proto=1 HTTP/1.1\r\nHost: 
freedb.freedb.org:80\r\nConnection: close)
-                   // Without proxy : "GET /~cddb/cddb.cgi?…" but doesn't work with a proxy.
-                   // With proxy    : "GET http://freedb.freedb.org/~cddb/cddb.cgi?…";
-                   cddb_in = g_strdup_printf("GET %s%s%s?cmd=cddb+read+"
-                                             "%s+%s"
-                                             "&hello=noname+localhost+%s+%s"
-                                             "&proto=6 HTTP/1.1\r\n"
-                                             "Host: %s:%d\r\n"
-                                             "%s"
-                                             "Connection: close\r\n\r\n",
-                                             CDDB_USE_PROXY?"http://":"",CDDB_USE_PROXY?cddb_server_name:"";, 
cddb_server_cgi_path,
-                                             cddbalbum->category,cddbalbum->id,
-                                             PACKAGE_NAME, PACKAGE_VERSION,
-                                             cddb_server_name,cddb_server_port,
-                                             (proxy_auth=Cddb_Format_Proxy_Authentification())
-                                             );
-               }
-
-               
-               g_free(proxy_auth);
-        //g_print("Request Cddb_Get_Album_Tracks_List : '%s'\n", cddb_in);
-
-        // Send the request
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Sending request…"));
-        while (gtk_events_pending()) gtk_main_iteration();
-        if ( (bytes_written=send(socket_id,cddb_in,strlen(cddb_in)+1,0)) < 0)
-        {
-            Log_Print(LOG_ERROR,_("Cannot send the request (%s)"),g_strerror(errno));
-            Cddb_Close_Connection(socket_id);
-            g_free(cddb_in);
-            return FALSE;
-        }
-        g_free(cddb_in);
-
-
-        // Read the answer
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Receiving data…"));
-        while (gtk_events_pending())
-            gtk_main_iteration();
-
-        // Write result in a file
-        if (Cddb_Write_Result_To_File(socket_id,&bytes_read_total) < 0)
-        {
-            msg = g_strdup(_("The server returned a bad response"));
-            gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
-            Log_Print(LOG_ERROR,"%s",msg);
-            g_free(msg);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),FALSE);
-            gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),FALSE);
-            return FALSE;
-        }
-
-
-        // Parse server answer : Check HTTP Header (freedb or gnudb) and CDDB Header (freedb only)
-        file = NULL;
-               if ( strstr(cddb_server_name,"gnudb") != NULL )
-               {
-                       // For gnudb (don't check CDDB header)
-                       if ( Cddb_Read_Http_Header(&file,&cddb_out) <= 0 )
-                   {
-                       gchar *msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
-                       gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
-                       Log_Print(LOG_ERROR,"%s",msg);
-                       g_free(msg);
-                       g_free(cddb_out);
-                       if (file)
-                           fclose(file);
-                       return FALSE;
-                   }
-               }else
-               {
-                       // For freedb
-                       if ( Cddb_Read_Http_Header(&file,&cddb_out) <= 0
-                     || Cddb_Read_Cddb_Header(&file,&cddb_out) <= 0 )
-                   {
-                       gchar *msg = g_strdup_printf(_("The server returned a bad response: %s"),cddb_out);
-                       gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
-                       Log_Print(LOG_ERROR,"%s",msg);
-                       g_free(msg);
-                       g_free(cddb_out);
-                       if (file)
-                           fclose(file);
-                       return FALSE;
-                   }
-               }
-        g_free(cddb_out);
-
-    }
-    cddb_end_str = g_strdup(".");
-
-    while ( CddbWindow && !CddbStopSearch
-    && Cddb_Read_Line(&file,&cddb_out) > 0 )
-    {
-        if (!cddb_out) // Empty line?
-            continue;
-        //g_print("%s\n",cddb_out);
-
-        // To avoid the cddb lookups to hang (Patch from Paul Giordano)
-        /* It appears that on some systems that cddb lookups continue to attempt
-         * to get data from the socket even though the other system has completed
-         * sending. The fix adds one check to the loops to see if the actual
-         * end of data is in the last block read. In this case, the last line
-         * will be a single '.'
-         */
-        if (strlen(cddb_out)<=3 && strstr(cddb_out,cddb_end_str)!=NULL)
-            break;
-
-        if ( strstr(cddb_out,"Track frame offsets")!=NULL ) // We read the Track frame offset
-        {
-            read_track_offset = TRUE; // The next reads are for the tracks offset
-            continue;
-
-        }else if (read_track_offset) // We are reading a track offset? (generates TrackOffsetList)
-        {
-            if ( strtoul(cddb_out+1,NULL,10)>0 )
-            {
-                CddbTrackFrameOffset *cddbtrackframeoffset = g_malloc0(sizeof(CddbTrackFrameOffset));
-                cddbtrackframeoffset->offset = strtoul(cddb_out+1,NULL,10);
-                TrackOffsetList = g_list_append(TrackOffsetList,cddbtrackframeoffset);
-            }else
-            {
-                read_track_offset = FALSE; // No more track offset
-            }
-            continue;
-
-        }else if ( strstr(cddb_out,"Disc length: ")!=NULL ) // Length of album (in second)
-        {
-            cddbalbum->duration = atoi(strchr(cddb_out,':')+1);
-            if (TrackOffsetList) // As it must be the last item, do nothing if no previous data
-            {
-                CddbTrackFrameOffset *cddbtrackframeoffset = g_malloc0(sizeof(CddbTrackFrameOffset));
-                cddbtrackframeoffset->offset = cddbalbum->duration * 75; // It's the last offset
-                TrackOffsetList = g_list_append(TrackOffsetList,cddbtrackframeoffset);
-            }
-            continue;
-
-        }else if ( strncmp(cddb_out,"DTITLE=",7)==0 ) // "Artist / Album" names
-        {
-            // Note : disc title too long take severals lines. For example :
-            // DTITLE=Marilyn Manson / The Nobodies (2005 Against All Gods Mix - Korea Tour L
-            // DTITLE=imited Edition)
-            if (!cddbalbum->album)
-            {
-                // It is the first time we find DTITLE...
-
-                gchar *alb_ptr = strstr(cddb_out," / ");
-                // Album
-                if (alb_ptr && alb_ptr+3)
-                {
-                    cddbalbum->album = Try_To_Validate_Utf8_String(alb_ptr+3);
-                    *alb_ptr = 0;
-                }
-
-                // Artist
-                cddbalbum->artist = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DTITLE='
-            }else
-            {
-                // It is at least the second time we find DTITLE
-                // So we suppose that only the album was truncated
+    gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_search_button), FALSE);
+    gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_auto_search_button),
+                                 FALSE);
 
-                // Album
-                valid = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DTITLE='
-                copy = cddbalbum->album; // To free...
-                cddbalbum->album = g_strconcat(cddbalbum->album,valid,NULL);
-                g_free(copy);
-            }
-            continue;
+    /* Initialize the button. */
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->display_red_lines_toggle),
+                                  FALSE);
 
-        }else if ( strncmp(cddb_out,"DYEAR=",6)==0 ) // Year
-        {
-            valid = Try_To_Validate_Utf8_String(cddb_out+6); // '6' to skip 'DYEAR='
-            if (g_utf8_strlen(valid, -1))
-                cddbalbum->year = valid;
-            continue;
-
-        }else if ( strncmp(cddb_out,"DGENRE=",7)==0 ) // Genre
-        {
-            valid = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DGENRE='
-            if (g_utf8_strlen(valid, -1))
-                cddbalbum->genre = valid;
-            continue;
-
-        }else if ( strncmp(cddb_out,"TTITLE",6)==0 ) // Track title (for exemple : TTITLE10=xxxx)
-        {
-            CddbTrackAlbum *cddbtrackalbum_last = NULL;
-
-            CddbTrackAlbum *cddbtrackalbum = g_malloc0(sizeof(CddbTrackAlbum));
-            cddbtrackalbum->cddbalbum = cddbalbum; // To find the CddbAlbum father quickly
-
-            // Here is a fix when TTITLExx doesn't contain an "=", we skip the line
-            if ( (copy = g_utf8_strchr(cddb_out,-1,'=')) != NULL )
-            {
-                cddbtrackalbum->track_name = Try_To_Validate_Utf8_String(copy+1);
-            }else
-            {
-                continue;
-            }
-
-            *g_utf8_strchr(cddb_out,-1,'=') = 0;
-            cddbtrackalbum->track_number = atoi(cddb_out+6)+1;
-
-            // Note : titles too long take severals lines. For example :
-            // TTITLE15=Bob Marley vs. Funkstar De Luxe Remix - Sun Is Shining (Radio De Lu
-            // TTITLE15=xe Edit)
-            // So to check it, we compare current track number with the previous one...
-            if (cddbalbum->track_list)
-                cddbtrackalbum_last = g_list_last(cddbalbum->track_list)->data;
-            if (cddbtrackalbum_last && cddbtrackalbum_last->track_number == cddbtrackalbum->track_number)
-            {
-                gchar *track_name = 
g_strconcat(cddbtrackalbum_last->track_name,cddbtrackalbum->track_name,NULL);
-                g_free(cddbtrackalbum_last->track_name);
-
-                cddbtrackalbum_last->track_name = Try_To_Validate_Utf8_String(track_name);
-
-                // Frees useless allocated data previously
-                g_free(cddbtrackalbum->track_name);
-                g_free(cddbtrackalbum);
-            }else
-            {
-                if (TrackOffsetList && TrackOffsetList->next)
-                {
-                    cddbtrackalbum->duration = ( ((CddbTrackFrameOffset 
*)TrackOffsetList->next->data)->offset - ((CddbTrackFrameOffset *)TrackOffsetList->data)->offset ) / 75; // 
Calculate time in seconds
-                    TrackOffsetList = TrackOffsetList->next;
-                }
-                cddbalbum->track_list = g_list_append(cddbalbum->track_list,cddbtrackalbum);
-            }
-            continue;
-
-        }else if ( strncmp(cddb_out,"EXTD=",5)==0 ) // Extended album data
-        {
-            gchar *genre_ptr = strstr(cddb_out,"ID3G:");
-            gchar *year_ptr  = strstr(cddb_out,"YEAR:");
-            // May contains severals EXTD field it too long
-            // EXTD=Techno
-            // EXTD= YEAR: 1997 ID3G:  18
-            // EXTD= ID3G:  17
-            if (year_ptr && cddbalbum->year)
-                cddbalbum->year = g_strdup_printf("%d",atoi(year_ptr+5));
-            if (genre_ptr && cddbalbum->genre)
-                cddbalbum->genre = g_strdup(Id3tag_Genre_To_String(atoi(genre_ptr+5)));
-            continue;
-        }
+    /* Load the albums found in the list. */
+    Cddb_Load_Album_List (self, FALSE);
 
-        g_free(cddb_out);
-    }
-    g_free(cddb_end_str);
-
-    // Close file opened for reading lines
-    if (file)
-    {
-        fclose(file);
-        file = NULL;
-    }
-
-    if (cddb_server_name)
-    {
-        // Remote access
-
-        /* Close connection */
-        Cddb_Close_Connection(socket_id);
-    }
-
-    /* Set color of the selected row (without reloading the whole list) */
-    Cddb_Album_List_Set_Row_Appearance(&row);
-
-    /* Load the track list of the album */
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Loading album track list…"));
-    while (gtk_events_pending()) gtk_main_iteration();
-    Cddb_Load_Track_Album_List(cddbalbum->track_list);
-
-    Cddb_Show_Album_Info(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView)),NULL);
-
-    // Frees 'TrackOffsetList'
-    g_list_free_full (TrackOffsetList, (GDestroyNotify)g_free);
-    TrackOffsetList = NULL;
     return TRUE;
 }
 
 /*
- * Set the row apperance depending if we have cached info or not
- * Bold/Red = Info are already loaded, but not displayed
- * Italic/Light Red = Duplicate CDDB entry
- */
-static void
-Cddb_Album_List_Set_Row_Appearance (GtkTreeIter *row)
-{
-    CddbAlbum *cddbalbum = NULL;
-
-    gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), row,
-                       CDDB_ALBUM_LIST_DATA, &cddbalbum, -1);
-
-    if (cddbalbum->track_list != NULL)
-    {
-        if (CHANGED_FILES_DISPLAYED_TO_BOLD)
-        {
-            gtk_list_store_set(CddbAlbumListModel, row,
-                               CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
-                               CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_BOLD,
-                               CDDB_ALBUM_LIST_FOREGROUND_COLOR, NULL,-1);
-        } else
-        {
-            if (cddbalbum->other_version == TRUE)
-            {
-                const GdkRGBA LIGHT_RED = { 1.0, 0.5, 0.5, 1.0};
-                gtk_list_store_set(CddbAlbumListModel, row,
-                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
-                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
-                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, &LIGHT_RED, -1);
-            } else
-            {
-                gtk_list_store_set(CddbAlbumListModel, row,
-                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
-                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
-                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, &RED, -1);
-            }
-        }
-    } else
-    {
-        if (cddbalbum->other_version == TRUE)
-        {
-            if (CHANGED_FILES_DISPLAYED_TO_BOLD)
-            {
-                gtk_list_store_set(CddbAlbumListModel, row,
-                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_ITALIC,
-                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
-                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, NULL,-1);
-            } else
-            {
-                const GdkRGBA GREY = { 0.664, 0.664, 0.664, 1.0 };
-                gtk_list_store_set(CddbAlbumListModel, row,
-                                   CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
-                                   CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
-                                   CDDB_ALBUM_LIST_FOREGROUND_COLOR, &GREY, -1);
-            }
-        } else
-        {
-            gtk_list_store_set(CddbAlbumListModel, row,
-                               CDDB_ALBUM_LIST_FONT_STYLE,       PANGO_STYLE_NORMAL,
-                               CDDB_ALBUM_LIST_FONT_WEIGHT,      PANGO_WEIGHT_NORMAL,
-                               CDDB_ALBUM_LIST_FOREGROUND_COLOR, NULL, -1);
-        }
-    }
-}
-
-
-/*
- * Set CDDB data (from tracks list) into tags of the main file list
- */
-static gboolean
-Cddb_Set_Track_Infos_To_File_List (void)
-{
-    guint row;
-    guint list_length;
-    guint rows_to_loop = 0;
-    guint selectedcount;
-    guint file_selectedcount;
-    guint counter = 0;
-    GList *file_iterlist = NULL;
-    GList *file_selectedrows;
-    GList *selectedrows = NULL;
-    gchar buffer[256];
-    gboolean CddbTrackList_Line_Selected;
-    gboolean cddbsettoallfields, cddbsettotitle,      cddbsettoartist, cddbsettoalbum, cddbsettoyear,
-             cddbsettotrack,     cddbsettotracktotal, cddbsettogenre,  cddbsettofilename;
-    CddbTrackAlbum *cddbtrackalbum = NULL;
-    GtkTreeSelection *selection = NULL;
-    GtkTreeSelection *file_selection = NULL;
-    GtkListStore *fileListModel;
-    GtkTreePath *currentPath = NULL;
-    GtkTreeIter  currentIter;
-    GtkTreeIter *fileIter;
-    gpointer iterptr;
-
-    g_return_val_if_fail (CddbWindow != NULL && BrowserList != NULL
-                          && ETCore->ETFileDisplayedList != NULL, FALSE);
-
-    // Save the current displayed data
-    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
-    cddbsettoallfields  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAllFields));
-    cddbsettotitle      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTitle));
-    cddbsettoartist     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToArtist));
-    cddbsettoalbum      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToAlbum));
-    cddbsettoyear       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToYear));
-    cddbsettotrack      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTrack));
-    cddbsettotracktotal = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToTrackTotal));
-    cddbsettogenre      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToGenre));
-    cddbsettofilename   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbSetToFileName));
-
-    fileListModel = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(BrowserList)));
-    list_length = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(CddbTrackListModel), NULL);
-
-    // Take the selected files in the cddb track list, else the full list
-    // Note : Just used to calculate "cddb_track_list_length" because
-    // "GPOINTER_TO_INT(cddb_track_list->data)" doesn't return the number of the
-    // line when "cddb_track_list = g_list_first(GTK_CLIST(CddbTrackCList)->row_list)"
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbTrackListView));
-    selectedcount = gtk_tree_selection_count_selected_rows(selection);
-
-    /* Check if at least one line was selected. No line selected is equal to all lines selected. */
-    CddbTrackList_Line_Selected = FALSE;
-
-    if (selectedcount > 0)
-    {
-        /* Loop through selected rows only */
-        CddbTrackList_Line_Selected = TRUE;
-        rows_to_loop = selectedcount;
-        selectedrows = gtk_tree_selection_get_selected_rows(selection, NULL);
-    } else
-    {
-        /* Loop through all rows */
-        CddbTrackList_Line_Selected = FALSE;
-        rows_to_loop = list_length;
-    }
-
-    file_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
-    file_selectedcount = gtk_tree_selection_count_selected_rows(file_selection);
-
-    if (file_selectedcount > 0)
-    {
-        GList *l;
-
-        /* Rows are selected in the file list, apply tags to them only */
-        file_selectedrows = gtk_tree_selection_get_selected_rows(file_selection, NULL);
-
-        for (l = file_selectedrows; l != NULL; l = g_list_next (l))
-        {
-            counter++;
-            iterptr = g_malloc0(sizeof(GtkTreeIter));
-            if (gtk_tree_model_get_iter (GTK_TREE_MODEL (fileListModel),
-                                         (GtkTreeIter *)iterptr,
-                                         (GtkTreePath *)l->data))
-            {
-                file_iterlist = g_list_prepend (file_iterlist, iterptr);
-            }
-
-            if (counter == rows_to_loop) break;
-        }
-
-        /* Free the useless bit */
-        g_list_free_full (file_selectedrows,
-                          (GDestroyNotify)gtk_tree_path_free);
-
-    } else /* No rows selected, use the first x items in the list */
-    {
-        gtk_tree_model_get_iter_first(GTK_TREE_MODEL(fileListModel), &currentIter);
-
-        do
-        {
-            counter++;
-            iterptr = g_memdup(&currentIter, sizeof(GtkTreeIter));
-            file_iterlist = g_list_prepend (file_iterlist, iterptr);
-        } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(fileListModel), &currentIter));
-
-        file_selectedcount = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(fileListModel), NULL);
-    }
-
-    if (file_selectedcount != rows_to_loop)
-    {
-        GtkWidget *msgdialog;
-        gint response;
-
-        msgdialog = gtk_message_dialog_new(GTK_WINDOW(CddbWindow),
-                                           GTK_DIALOG_MODAL  | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                           GTK_MESSAGE_QUESTION,
-                                           GTK_BUTTONS_NONE,
-                                           "%s",
-                                           _("The number of CDDB results does not match the number of 
selected files"));
-        
gtk_dialog_add_buttons(GTK_DIALOG(msgdialog),GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,GTK_STOCK_APPLY,GTK_RESPONSE_APPLY,
 NULL);
-        gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(msgdialog),"%s","Do you want to 
continue?");
-        gtk_window_set_title (GTK_WINDOW (msgdialog),
-                              _("Write Tag from CDDB"));
-        response = gtk_dialog_run(GTK_DIALOG(msgdialog));
-        gtk_widget_destroy(msgdialog);
-
-        if (response != GTK_RESPONSE_APPLY)
-        {
-            g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
-            //gdk_window_raise(CddbWindow->window);
-            return FALSE;
-        }
-    }
-
-    file_iterlist = g_list_reverse (file_iterlist);
-    //ET_Debug_Print_File_List (NULL, __FILE__, __LINE__, __FUNCTION__);
-
-    for (row=0; row < rows_to_loop; row++)
-    {
-        if (CddbTrackList_Line_Selected == FALSE)
-        {
-            if(row == 0)
-                currentPath = gtk_tree_path_new_first();
-            else
-                gtk_tree_path_next(currentPath);
-        } else /* (e.g.: if CddbTrackList_Line_Selected == TRUE) */
-        {
-            if(row == 0)
-            {
-                selectedrows = g_list_first(selectedrows);
-                currentPath = (GtkTreePath *)selectedrows->data;
-            } else
-            {
-                selectedrows = g_list_next(selectedrows);
-                currentPath = (GtkTreePath *)selectedrows->data;
-            }
-        }
-
-        if (gtk_tree_model_get_iter (GTK_TREE_MODEL (CddbTrackListModel),
-                                     &currentIter, currentPath))
-        {
-            gtk_tree_model_get (GTK_TREE_MODEL (CddbTrackListModel),
-                                &currentIter, CDDB_TRACK_LIST_DATA,
-                                &cddbtrackalbum, -1);
-        }
-        else
-        {
-            g_warning ("Iter not found matching path in CDDB track list model");
-        }
-
-        // Set values in the ETFile
-        if (CDDB_USE_DLM)
-        {
-            // RQ : this part is ~ equal to code for '!CDDB_USE_DLM', but uses '*etfile' instead of 'etfile'
-            ET_File **etfile = NULL;
-            File_Name *FileName = NULL;
-            File_Tag *FileTag = NULL;
-
-            gtk_tree_model_get(GTK_TREE_MODEL(CddbTrackListModel), &currentIter,
-                               CDDB_TRACK_LIST_ETFILE, &etfile, -1);
-
-            /*
-             * Tag fields
-             */
-            if (cddbsettoallfields || cddbsettotitle || cddbsettoartist
-                || cddbsettoalbum || cddbsettoyear || cddbsettotrack
-                || cddbsettotracktotal || cddbsettogenre)
-            {
-                // Allocation of a new FileTag
-                FileTag = ET_File_Tag_Item_New();
-                ET_Copy_File_Tag_Item(*etfile,FileTag);
-
-                if (cddbsettoallfields || cddbsettotitle)
-                    ET_Set_Field_File_Tag_Item(&FileTag->title,cddbtrackalbum->track_name);
-
-                if ( (cddbsettoallfields || cddbsettoartist) && cddbtrackalbum->cddbalbum->artist)
-                    ET_Set_Field_File_Tag_Item(&FileTag->artist,cddbtrackalbum->cddbalbum->artist);
-
-                if ( (cddbsettoallfields || cddbsettoalbum) && cddbtrackalbum->cddbalbum->album)
-                    ET_Set_Field_File_Tag_Item(&FileTag->album, cddbtrackalbum->cddbalbum->album);
-
-                if ( (cddbsettoallfields || cddbsettoyear) && cddbtrackalbum->cddbalbum->year)
-                    ET_Set_Field_File_Tag_Item(&FileTag->year,  cddbtrackalbum->cddbalbum->year);
-
-                if (cddbsettoallfields || cddbsettotrack)
-                {
-                    snprintf (buffer, sizeof (buffer), "%s",
-                              et_track_number_to_string (cddbtrackalbum->track_number));
-
-                    ET_Set_Field_File_Tag_Item(&FileTag->track,buffer);
-                }
-
-                if (cddbsettoallfields || cddbsettotracktotal)
-                {
-                    snprintf (buffer, sizeof (buffer), "%s",
-                              et_track_number_to_string (list_length));
-
-                    ET_Set_Field_File_Tag_Item(&FileTag->track_total,buffer);
-                }
-
-                if ( (cddbsettoallfields || cddbsettogenre) && (cddbtrackalbum->cddbalbum->genre || 
cddbtrackalbum->cddbalbum->category) )
-                {
-                    if (cddbtrackalbum->cddbalbum->genre && g_utf8_strlen(cddbtrackalbum->cddbalbum->genre, 
-1)>0)
-                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->genre));
-                    else
-                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->category));
-                }
-            }
-
-            /*
-             * Filename field
-             */
-            if ( (cddbsettoallfields || cddbsettofilename) )
-            {
-                gchar *filename_generated_utf8;
-                gchar *filename_new_utf8;
-
-                // Allocation of a new FileName
-                FileName = ET_File_Name_Item_New();
-
-                // Build the filename with the path
-                snprintf (buffer, sizeof (buffer), "%s",
-                          et_track_number_to_string (cddbtrackalbum->track_number));
-
-                filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
-                ET_File_Name_Convert_Character(filename_generated_utf8); // Replace invalid characters
-                filename_new_utf8 = ET_File_Name_Generate(*etfile,filename_generated_utf8);
-
-                ET_Set_Filename_File_Name_Item(FileName,filename_new_utf8,NULL);
-
-                g_free(filename_generated_utf8);
-                g_free(filename_new_utf8);
-            }
-
-            ET_Manage_Changes_Of_File_Data(*etfile,FileName,FileTag);
-
-            // Then run current scanner if asked...
-            if (ScannerWindow && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbRunScanner)) )
-                Scan_Select_Mode_And_Run_Scanner(*etfile);
-
-        } else if (cddbtrackalbum && file_iterlist && file_iterlist->data)
-        {
-            ET_File   *etfile;
-            File_Name *FileName = NULL;
-            File_Tag  *FileTag  = NULL;
-
-            fileIter = (GtkTreeIter*) file_iterlist->data;
-            etfile = Browser_List_Get_ETFile_From_Iter(fileIter);
-
-            /*
-             * Tag fields
-             */
-            if (cddbsettoallfields || cddbsettotitle || cddbsettoartist
-                || cddbsettoalbum || cddbsettoyear || cddbsettotrack
-                || cddbsettotracktotal || cddbsettogenre)
-            {
-                // Allocation of a new FileTag
-                FileTag = ET_File_Tag_Item_New();
-                ET_Copy_File_Tag_Item(etfile,FileTag);
-
-                if (cddbsettoallfields || cddbsettotitle)
-                    ET_Set_Field_File_Tag_Item(&FileTag->title,cddbtrackalbum->track_name);
-
-                if ( (cddbsettoallfields || cddbsettoartist) && cddbtrackalbum->cddbalbum->artist)
-                    ET_Set_Field_File_Tag_Item(&FileTag->artist,cddbtrackalbum->cddbalbum->artist);
-
-                if ( (cddbsettoallfields || cddbsettoalbum) && cddbtrackalbum->cddbalbum->album)
-                    ET_Set_Field_File_Tag_Item(&FileTag->album, cddbtrackalbum->cddbalbum->album);
-
-                if ( (cddbsettoallfields || cddbsettoyear) && cddbtrackalbum->cddbalbum->year)
-                    ET_Set_Field_File_Tag_Item(&FileTag->year,  cddbtrackalbum->cddbalbum->year);
-
-                if (cddbsettoallfields || cddbsettotrack)
-                {
-                    snprintf (buffer, sizeof (buffer), "%s",
-                              et_track_number_to_string (cddbtrackalbum->track_number));
-
-                    ET_Set_Field_File_Tag_Item(&FileTag->track,buffer);
-                }
-
-                if (cddbsettoallfields || cddbsettotracktotal)
-                {
-                    snprintf (buffer, sizeof (buffer), "%s",
-                              et_track_number_to_string (list_length));
-
-                    ET_Set_Field_File_Tag_Item(&FileTag->track_total,buffer);
-                }
-
-                if ( (cddbsettoallfields || cddbsettogenre) && (cddbtrackalbum->cddbalbum->genre || 
cddbtrackalbum->cddbalbum->category) )
-                {
-                    if (cddbtrackalbum->cddbalbum->genre && g_utf8_strlen(cddbtrackalbum->cddbalbum->genre, 
-1)>0)
-                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->genre));
-                    else
-                        
ET_Set_Field_File_Tag_Item(&FileTag->genre,Cddb_Get_Id3_Genre_From_Cddb_Genre(cddbtrackalbum->cddbalbum->category));
-                }
-            }
-
-            /*
-             * Filename field
-             */
-            if ( (cddbsettoallfields || cddbsettofilename) )
-            {
-                gchar *filename_generated_utf8;
-                gchar *filename_new_utf8;
-
-                // Allocation of a new FileName
-                FileName = ET_File_Name_Item_New();
-
-                // Build the filename with the path
-                snprintf (buffer, sizeof (buffer), "%s",
-                          et_track_number_to_string (cddbtrackalbum->track_number));
-
-                filename_generated_utf8 = g_strconcat(buffer," - ",cddbtrackalbum->track_name,NULL);
-                ET_File_Name_Convert_Character(filename_generated_utf8); // Replace invalid characters
-                filename_new_utf8 = ET_File_Name_Generate(etfile,filename_generated_utf8);
-
-                ET_Set_Filename_File_Name_Item(FileName,filename_new_utf8,NULL);
-
-                g_free(filename_generated_utf8);
-                g_free(filename_new_utf8);
-            }
-
-            ET_Manage_Changes_Of_File_Data(etfile,FileName,FileTag);
-
-            // Then run current scanner if asked...
-            if (ScannerWindow && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbRunScanner)) )
-                Scan_Select_Mode_And_Run_Scanner(etfile);
-        }
-
-        if(!file_iterlist->next) break;
-        file_iterlist = file_iterlist->next;
-    }
-
-    g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
-
-    Browser_List_Refresh_Whole_List();
-    ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
-
-    return TRUE;
-}
-
-
-static void
-Cddb_Display_Red_Lines_In_Result (void)
-{
-    g_return_if_fail (CddbDisplayRedLinesButton != NULL);
-
-    if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbDisplayRedLinesButton)) )
-    {
-        // Show only red lines
-        Cddb_Load_Album_List(TRUE);
-    }else
-    {
-        // Show all lines
-        Cddb_Load_Album_List(FALSE);
-    }
-}
-
-
-/*
  * Returns the corresponding ID3 genre (the name, not the value)
  */
 static const gchar *
@@ -4332,3 +4403,48 @@ Cddb_Format_Proxy_Authentification (void)
     }
     return ret;
 }
+
+static void
+et_cddb_dialog_finalize (GObject *object)
+{
+    EtCDDBDialog *self;
+
+    self = ET_CDDB_DIALOG (object);
+
+    Cddb_Free_Album_List (self);
+
+    G_OBJECT_CLASS (et_cddb_dialog_parent_class)->finalize (object);
+}
+
+static void
+et_cddb_dialog_init (EtCDDBDialog *self)
+{
+    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_CDDB_DIALOG,
+                                              EtCDDBDialogPrivate);
+
+    self->priv->album_list = NULL;
+    self->priv->stop_searching = FALSE;
+
+    create_cddb_dialog (self);
+}
+
+static void
+et_cddb_dialog_class_init (EtCDDBDialogClass *klass)
+{
+    G_OBJECT_CLASS (klass)->finalize = et_cddb_dialog_finalize;
+
+    g_type_class_add_private (klass, sizeof (EtCDDBDialogPrivate));
+}
+
+/*
+ * et_cddb_dialog_new:
+ *
+ * Create a new EtCDDBDialog instance.
+ *
+ * Returns: a new #EtCDDBDialog
+ */
+EtCDDBDialog *
+et_cddb_dialog_new (void)
+{
+    return g_object_new (ET_TYPE_CDDB_DIALOG, NULL);
+}
diff --git a/src/cddb_dialog.h b/src/cddb_dialog.h
new file mode 100644
index 0000000..1b72870
--- /dev/null
+++ b/src/cddb_dialog.h
@@ -0,0 +1,54 @@
+/*
+ *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
+ *  Copyright (C) 2000-2003  Jerome Couderc <easytag gmail com>
+ *
+ *  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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ET_CDDB_DIALOG_H_
+#define ET_CDDB_DIALOG_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define ET_TYPE_CDDB_DIALOG (et_cddb_dialog_get_type ())
+#define ET_CDDB_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), ET_TYPE_CDDB_DIALOG, EtCDDBDialog))
+
+typedef struct _EtCDDBDialog EtCDDBDialog;
+typedef struct _EtCDDBDialogClass EtCDDBDialogClass;
+typedef struct _EtCDDBDialogPrivate EtCDDBDialogPrivate;
+
+struct _EtCDDBDialog
+{
+    /*< private >*/
+    GtkDialog parent_instance;
+    EtCDDBDialogPrivate *priv;
+};
+
+struct _EtCDDBDialogClass
+{
+    /*< private >*/
+    GtkDialogClass parent_class;
+};
+
+GType et_cddb_dialog_get_type (void);
+EtCDDBDialog *et_cddb_dialog_new (void);
+void et_cddb_dialog_apply_changes (EtCDDBDialog *self);
+gboolean et_cddb_dialog_search_from_selection (EtCDDBDialog *self);
+
+G_END_DECLS
+
+#endif /* ET_CDDB_H_ */
diff --git a/src/easytag.c b/src/easytag.c
index 5ac15cd..61a9938 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -43,6 +43,7 @@
 #include "log.h"
 #include "misc.h"
 #include "bar.h"
+#include "cddb_dialog.h"
 #include "preferences_dialog.h"
 #include "setting.h"
 #include "scan.h"
@@ -51,7 +52,6 @@
 #include "id3_tag.h"
 #include "ogg_tag.h"
 #include "et_core.h"
-#include "cddb.h"
 #include "picture.h"
 #include "charset.h"
 
@@ -136,7 +136,6 @@ common_init (GApplication *application)
     Init_Custom_Icons();
     Init_Mouse_Cursor();
     Init_ScannerWindow();
-    Init_CddbWindow();
     BrowserEntryModel    = NULL;
     TrackEntryComboModel = NULL;
     GenreComboModel      = NULL;
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 7418f99..d9ddc56 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -38,7 +38,7 @@
 #include "scan.h"
 #include "easytag.h"
 #include "browser.h"
-#include "cddb.h"
+#include "cddb_dialog.h"
 #include "charset.h"
 #include "win32/win32dep.h"
 
diff --git a/src/setting.c b/src/setting.c
index 7ccf8fd..a9a5f29 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -33,6 +33,7 @@
 
 #include "setting.h"
 #include "application_window.h"
+#include "cddb_dialog.h"
 #include "load_files_dialog.h"
 #include "playlist_dialog.h"
 #include "preferences_dialog.h"
@@ -43,7 +44,6 @@
 #include "scan_dialog.h"
 #include "log.h"
 #include "misc.h"
-#include "cddb.h"
 #include "browser.h"
 #include "et_core.h"
 
@@ -260,12 +260,6 @@ static const tConfigVariable Config_Variables[] =
     {"cddb_proxy_port",                         CV_TYPE_INT,     &CDDB_PROXY_PORT                        },
     {"cddb_proxy_user_name",                    CV_TYPE_STRING,  &CDDB_PROXY_USER_NAME                   },
     {"cddb_proxy_user_password",                CV_TYPE_STRING,  &CDDB_PROXY_USER_PASSWORD               },
-    {"set_cddb_window_position",                CV_TYPE_BOOL,    &SET_CDDB_WINDOW_POSITION               },
-    {"cddb_window_x",                           CV_TYPE_INT,     &CDDB_WINDOW_X                          },
-    {"cddb_window_y",                           CV_TYPE_INT,     &CDDB_WINDOW_Y                          },
-    {"cddb_window_height",                      CV_TYPE_INT,     &CDDB_WINDOW_HEIGHT                     },
-    {"cddb_window_width",                       CV_TYPE_INT,     &CDDB_WINDOW_WIDTH                      },
-    {"cddb_pane_handle_position",               CV_TYPE_INT,     &CDDB_PANE_HANDLE_POSITION              },
 
     {"cddb_follow_file",                        CV_TYPE_BOOL,    &CDDB_FOLLOW_FILE                       },
     {"cddb_use_dlm",                            CV_TYPE_BOOL,    &CDDB_USE_DLM                           },
@@ -525,13 +519,6 @@ void Init_Config_Variables (void)
     CDDB_PROXY_USER_NAME                    = NULL;
     CDDB_PROXY_USER_PASSWORD                = NULL;
 
-    SET_CDDB_WINDOW_POSITION      = 1; // Set it to '0' if problem with some Windows Manager
-    CDDB_WINDOW_X                 = -1;
-    CDDB_WINDOW_Y                 = -1;
-    CDDB_WINDOW_WIDTH             = 660;
-    CDDB_WINDOW_HEIGHT            = 470;
-    CDDB_PANE_HANDLE_POSITION     = 350;
-
     CDDB_FOLLOW_FILE              = 1;
     CDDB_USE_DLM                  = 0;
     CDDB_USE_LOCAL_ACCESS         = 0;
@@ -845,8 +832,9 @@ Apply_Changes_Of_UI (void)
     // Configuration of the scanner window (see scan.c) - Function also called when destroying the window
     ScannerWindow_Apply_Changes();
 
-    // Configuration of the cddb window (see cddb.c) - Function also called when destroying the window
-    Cddb_Window_Apply_Changes();
+    /* Configuration of the cddb window (see cddb_dialog.c).
+     * Function also called when destroying the window. */
+    et_cddb_dialog_apply_changes (ET_CDDB_DIALOG (et_application_window_get_cddb_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
     /* Configuration of the playlist window (see playlist_dialog.c).
      * Function also called when destroying the window. */
diff --git a/src/setting.h b/src/setting.h
index 0986c1d..6aa2b84 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -212,13 +212,6 @@ gint    CDDB_PROXY_PORT;
 gchar  *CDDB_PROXY_USER_NAME;
 gchar  *CDDB_PROXY_USER_PASSWORD;
 
-gint    SET_CDDB_WINDOW_POSITION;
-gint    CDDB_WINDOW_X;
-gint    CDDB_WINDOW_Y;
-gint    CDDB_WINDOW_HEIGHT;
-gint    CDDB_WINDOW_WIDTH;
-gint    CDDB_PANE_HANDLE_POSITION;
-
 gint    CDDB_FOLLOW_FILE;
 gint    CDDB_USE_DLM;
 gint    CDDB_USE_LOCAL_ACCESS;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]