[easytag/wip/application-window: 12/16] Move CDDB dialog to EtCDDBDialog object



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

    Move CDDB dialog to EtCDDBDialog object

 Makefile.am                   |    4 +-
 src/application_window.c      |   48 +
 src/application_window.h      |    3 +
 src/bar.c                     |    9 +-
 src/cddb.h                    |   33 -
 src/{cddb.c => cddb_dialog.c} | 4529 +++++++++++++++++++++--------------------
 src/cddb_dialog.h             |   54 +
 src/easytag.c                 |    3 +-
 src/preferences_dialog.c      |    2 +-
 src/setting.c                 |   20 +-
 src/setting.h                 |    7 -
 11 files changed, 2442 insertions(+), 2270 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0dd5c45..4672595 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,7 +39,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 \
@@ -82,7 +82,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/src/application_window.c b/src/application_window.c
index a272623..3d3987a 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"
@@ -47,6 +48,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;
@@ -1642,6 +1644,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);
@@ -1663,6 +1666,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;
@@ -1918,6 +1922,50 @@ et_application_window_show_preferences_dialog (G_GNUC_UNUSED GtkAction *action,
     }
 }
 
+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 ());
+    }
+}
+
+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 4044fbe..7d764f3 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -59,6 +59,9 @@ GtkWidget * et_application_window_get_search_dialog (EtApplicationWindow *self);
 void et_application_window_show_search_dialog (GtkAction *action, gpointer user_data);
 GtkWidget * et_application_window_get_preferences_dialog (EtApplicationWindow *self);
 void et_application_window_show_preferences_dialog (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 575501f..0b55278 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -31,7 +31,7 @@
 #include "setting.h"
 #include "browser.h"
 #include "scan.h"
-#include "cddb.h"
+#include "cddb_dialog.h"
 #include "log.h"
 #include "misc.h"
 #include "charset.h"
@@ -287,7 +287,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"),
@@ -325,7 +326,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 56366d3..eaae110 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,136 +219,20 @@ 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);
 
@@ -288,1062 +240,328 @@ static gchar *Cddb_Format_Proxy_Authentification (void);
 
 
 
-/*************
- * 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_COLOR);
-    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-gdk", 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-gdk", 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);
-    }
-}
-
-static void
-Cddb_Use_Dlm_2_Check_Button_Toggled (void)
-{
-    if (CddbUseDLM2)
-    {
-        CDDB_USE_DLM = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseDLM2));
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->apply_button),FALSE);
     }
 }
 
 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 = iter;
 
-    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 = iter;
 
-            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,158 @@ 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)
+            {
+                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
+            {
+                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;
 }
 
 
 /*
- * To run an "automatic search" from a popup menu with the sélected files
+ * Load the priv->album_list into the corresponding List
  */
-void Cddb_Popup_Menu_Search_Selected_File (void)
+static void
+Cddb_Load_Album_List (EtCDDBDialog *self, gboolean only_red_lines)
 {
-    Open_Cddb_Window();
-    Cddb_Search_Album_From_Selected_Files();
-}
+    EtCDDBDialogPrivate *priv;
+    GtkTreeIter iter;
+    GList *l;
 
-/*
- * 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;
+    GtkTreeSelection *selection;
+    GList            *selectedRows = NULL;
+    GtkTreeIter       currentIter;
+    CddbAlbum        *cddbalbumSelected = NULL;
 
-    switch (sortcol)
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    // 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)
     {
-        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;
+        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);
+    }
 
-        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);
+    // Remove lines
+    gtk_list_store_clear(priv->album_list_model);
 
-            g_free(text1);
-            g_free(text2);
-            g_free(text1cp);
-            g_free(text2cp);
-            break;
+    // 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);
+        }
     }
+}
 
-    return ret;
+static void
+Cddb_Display_Red_Lines_In_Result (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+
+    priv = et_cddb_dialog_get_instance_private (self);
+
+    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);
+    }
 }
 
 /*
@@ -1571,8 +838,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 +850,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 +899,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 +917,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 +930,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 +954,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 +966,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 +984,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 +1020,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 +1039,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 +1064,8 @@ Cddb_Write_Result_To_File (gint socket_id, gulong *bytes_read_total)
             // Display message
             size_str = Convert_Size_1(*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,162 +1091,22 @@ 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"
- */
-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;
-}
-
-
-
-/*
- * Free the CddbAlbumList
+ * Free priv->album_list
  */
 static gboolean
-Cddb_Free_Album_List (void)
+Cddb_Free_Album_List (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     GList *l;
 
-    g_return_val_if_fail (CddbAlbumList != NULL, FALSE);
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    CddbAlbumList = g_list_first (CddbAlbumList);
+    g_return_val_if_fail (priv->album_list != NULL, FALSE);
 
-    for (l = CddbAlbumList; l != NULL; l = g_list_next (l))
+    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;
 
@@ -1996,162 +1134,37 @@ Cddb_Free_Album_List (void)
         }
     }
 
-    g_list_free(CddbAlbumList);
-
-    return TRUE;
-}
-
-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);
+    g_list_free (priv->album_list);
+    priv->album_list = NULL;
 
     return TRUE;
 }
 
-
-
-/*
- * Load the CddbAlbumList into the corresponding List
- */
-static void
-Cddb_Load_Album_List (gboolean only_red_lines)
-{
-    if (CddbWindow && CddbAlbumList && CddbAlbumListView)
-    {
-        GtkTreeIter iter;
-        GList *l;
-
-        GtkTreeSelection *selection;
-        GList            *selectedRows = NULL;
-        GtkTreeIter       currentIter;
-        CddbAlbum        *cddbalbumSelected = NULL;
-
-        // 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);
-        }
-
-        // Remove lines
-        gtk_list_store_clear(CddbAlbumListModel);
-
-        // Reload list following parameter 'only_red_lines'
-        for (l = g_list_first (CddbAlbumList); 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 (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);
-            }
-        }
-    }
-}
-
-
-/*
- * 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
-        gtk_list_store_clear(CddbTrackListModel);
-
-        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);
-
-            /* 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();
-    }
-}
-
 /*
  * Fields          : artist, title, track, rest
  * 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);
@@ -2163,17 +1176,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)
@@ -2200,30 +1213,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;
@@ -2247,10 +1244,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;
 
@@ -2265,7 +1264,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 )
@@ -2276,12 +1275,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;
     }
 
@@ -2299,7 +1299,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())
@@ -2311,12 +1311,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);
@@ -2327,35 +1327,35 @@ Cddb_Search_Album_List_From_String_Freedb (void)
 
 
     // Delete previous album list
-    gtk_list_store_clear(CddbAlbumListModel);
-    gtk_list_store_clear(CddbTrackListModel);
-    if (CddbAlbumList)
+    gtk_list_store_clear(priv->album_list_model);
+    gtk_list_store_clear(priv->track_list_model);
+    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;
     }
 
@@ -2363,14 +1363,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;
@@ -2386,7 +1386,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;
@@ -2474,7 +1474,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)
@@ -2502,37 +1502,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;
@@ -2560,11 +1560,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;
 
@@ -2579,7 +1580,7 @@ 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 )
@@ -2587,15 +1588,14 @@ Cddb_Search_Album_List_From_String_Gnudb (void)
 
 
     // Delete previous album list
-    gtk_list_store_clear(CddbAlbumListModel);
-    gtk_list_store_clear(CddbTrackListModel);
-    if (CddbAlbumList)
+    gtk_list_store_clear(priv->album_list_model);
+    gtk_list_store_clear(priv->track_list_model);
+    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
@@ -2606,14 +1606,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;
         }
 
@@ -2640,18 +1641,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);
@@ -2665,23 +1668,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;
         }
 
@@ -2690,15 +1693,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;
@@ -2722,7 +1725,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;
@@ -2805,7 +1808,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)
@@ -2828,7 +1831,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())
@@ -2850,561 +1853,89 @@ 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(FALSE);
+    /* Load the albums found in the list. */
+    Cddb_Load_Album_List (self, FALSE);
 
     return TRUE;
 }
 
-
 /*
- * Send cddb query using the CddbId generated from the selected files to get the
- * list of albums matching with this cddbid.
+ * Select the function to use according the server adress for the manual search
+ *      - freedb.freedb.org
+ *      - gnudb.gnudb.org
  */
 static gboolean
-Cddb_Search_Album_From_Selected_Files (void)
+Cddb_Search_Album_List_From_String (EtCDDBDialog *self)
 {
-    gint   socket_id;
-    gint   bytes_written;
-    gulong bytes_read_total = 0;
-    FILE  *file = NULL;
-
-    gchar *cddb_in = NULL; /* For the request to send. */
-    gchar *cddb_out = NULL;       /* Answer received */
-    gchar *cddb_out_tmp;
-    gchar *msg;
-    gchar *proxy_auth;
-    gchar *cddb_server_name;
-    gint   cddb_server_port;
-    gchar *cddb_server_cgi_path;
-    gint   server_try = 0;
-    gchar *tmp, *valid;
-    gchar *query_string;
-    gchar *cddb_discid;
-    gchar *cddb_end_str;
-
-    guint total_frames = 150;   /* First offset is (almost) always 150 */
-    guint disc_length  = 2;     /* and 2s elapsed before first track */
-
-    GtkTreeSelection *file_selection = NULL;
-    guint file_selectedcount = 0;
-    GtkTreeIter  currentIter;
-    guint total_id;
-    guint num_tracks;
-
-    gpointer iterptr;
-
-    GtkListStore *fileListModel;
-    GtkTreeIter *fileIter;
-    GList *file_iterlist = NULL;
-    GList *l;
-
-    g_return_val_if_fail (BrowserList != NULL, FALSE);
-
-    // 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));
-    file_selectedcount = gtk_tree_selection_count_selected_rows(file_selection);
-
-    // Create the list 'file_iterlist' of selected files (no selected files => all files selected)
-    if (file_selectedcount > 0)
-    {
-        GList* file_selectedrows = gtk_tree_selection_get_selected_rows(file_selection, NULL);
-
-        for (l = file_selectedrows; l != NULL; l = g_list_next (l))
-        {
-            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);
-            }
-        }
-        g_list_free_full (file_selectedrows,
-                          (GDestroyNotify)gtk_tree_path_free);
-
-    } else /* No rows selected, use the whole list */
-    {
-        gtk_tree_model_get_iter_first(GTK_TREE_MODEL(fileListModel), &currentIter);
-
-        do
-        {
-            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 == 0)
-    {
-        msg = g_strdup_printf(_("No file selected"));
-        gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,msg);
-        g_free(msg);
-        return TRUE;
-    }else if (file_selectedcount > 99)
-    {
-        // 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);
-        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);
-        g_free(msg);
-    }
-
-    // Generate query string and compute discid from the list 'file_iterlist'
-    total_id = 0;
-    num_tracks = file_selectedcount;
-    query_string = g_strdup("");
-
-    for (l = g_list_reverse (file_iterlist); l != NULL; l = g_list_next (l))
-    {
-        ET_File *etfile;
-        gulong secs = 0;
-
-        fileIter = (GtkTreeIter *)l->data;
-        etfile = Browser_List_Get_ETFile_From_Iter(fileIter);
-
-        tmp = query_string;
-        if (strlen(query_string)>0)
-            query_string = g_strdup_printf("%s+%d", query_string, total_frames);
-        else
-            query_string = g_strdup_printf("%d", total_frames);
-        g_free(tmp);
-
-        secs = etfile->ETFileInfo->duration;
-        total_frames += secs * 75;
-        disc_length  += secs;
-        while (secs > 0)
-        {
-            total_id = total_id + (secs % 10);
-            secs = secs / 10;
-        }
-    }
-
-    g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
-
-    // Compute CddbId
-    cddb_discid = g_strdup_printf("%08x",(guint)(((total_id % 0xFF) << 24) |
-                                         (disc_length << 8) | num_tracks));
-
+    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);
+}
 
-    // Delete previous album list
-    gtk_list_store_clear(CddbAlbumListModel);
-    gtk_list_store_clear(CddbTrackListModel);
-    if (CddbAlbumList)
-    {
-        Cddb_Free_Album_List();
-        CddbAlbumList = NULL;
-    }
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchButton),TRUE);
-    gtk_widget_set_sensitive(GTK_WIDGET(CddbStopSearchAutoButton),TRUE);
+/*
+ * Load the CddbTrackList into the corresponding List
+ */
+static void
+Cddb_Load_Track_Album_List (EtCDDBDialog *self, GList *track_list)
+{
+    EtCDDBDialogPrivate *priv;
 
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    CDDB_USE_LOCAL_ACCESS = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbUseLocalAccess));
-    if (CDDB_USE_LOCAL_ACCESS) // Remote or Local acces?
+    if (track_list && priv->track_list_view)
     {
-        /*
-         * Local cddb acces
-         */
-        static const gchar *CddbDir[] = // Or use cddb_genre_vs_id3_genre[][2]?
-        {
-            "blues", "classical", "country", "data",   "folk",
-            "jazz",  "misc",      "newage",  "reggae", "rock",
-            "soundtrack"
-        };
-        static const gsize CddbDirSize = G_N_ELEMENTS (CddbDir) - 1;
-        gsize i;
-
-        // We check if the file corresponding to the discid exists in each directory
-        for (i=0; i<=CddbDirSize; i++)
-        {
-            gchar *file_path;
-
-            if (!CDDB_LOCAL_PATH || strlen(CDDB_LOCAL_PATH)==0)
-            {
-                GtkWidget *msgdialog;
-
-                msgdialog = gtk_message_dialog_new(GTK_WINDOW(CddbWindow),
-                                                   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                   GTK_MESSAGE_ERROR,
-                                                   GTK_BUTTONS_CLOSE,
-                                                   "%s",
-                                                   _("The path for 'Local CD Database' was not defined"));
-                /* Translators: 'it' in this sentence refers to the local CD
-                 * database path. */
-                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(msgdialog), "%s", _("Enter it in 
the preferences window before using this search."));
-                gtk_window_set_title (GTK_WINDOW (msgdialog),
-                                      _("Local CD search"));
-
-                gtk_dialog_run(GTK_DIALOG(msgdialog));
-                gtk_widget_destroy(msgdialog);
-                break;
-            }
-            file_path = g_strconcat(CDDB_LOCAL_PATH,
-                                    CDDB_LOCAL_PATH[strlen(CDDB_LOCAL_PATH)-1]!=G_DIR_SEPARATOR ? 
G_DIR_SEPARATOR_S : "",
-                                    CddbDir[i],"/",cddb_discid,NULL);
-
-            if ( (file=fopen(file_path,"r"))!=0 )
-            {
-                // File found
-                CddbAlbum *cddbalbum;
-                gint rc = 0;
-
-                cddbalbum = g_malloc0(sizeof(CddbAlbum));
-
-                // Parameters of the server used (Local acces => specific!)
-                cddbalbum->server_name     = NULL;                // No server name
-                cddbalbum->server_port     = 0;                   // No server port
-                cddbalbum->server_cgi_path = g_strdup(file_path); /* Filename. */
-                cddbalbum->bitmap          = Cddb_Get_Pixbuf_From_Server_Name(file_path);
-
-                // Get album category
-                cddbalbum->category = Try_To_Validate_Utf8_String(CddbDir[i]);
-
-                // Get album ID
-                cddbalbum->id = Try_To_Validate_Utf8_String(cddb_discid);
-
-                while ( CddbWindow && !CddbStopSearch
-                && (rc = Cddb_Read_Line(&file,&cddb_out)) > 0 )
-                {
-                    if (!cddb_out) // Empty line?
-                        continue;
-                    //g_print("%s\n",cddb_out);
-
-                    // Get Album and Artist names
-                    if ( strncmp(cddb_out,"DTITLE=",7)==0 )
-                    {
-                        // 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->artist_album)
-                        {
-                            // It is the first time we find DTITLE...
-
-                            // Artist and album
-                            cddbalbum->artist_album = 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
-
-                            // Album
-                            valid = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DTITLE='
-                            tmp = cddbalbum->artist_album; // To free...
-                            cddbalbum->artist_album = g_strconcat(cddbalbum->artist_album,valid,NULL);
-                            g_free(tmp);
-
-                            // Don't need to read more data to read in the file
-                            break;
-                        }
-                    }
-
-                    g_free(cddb_out);
-                }
-
-                CddbAlbumList = g_list_append(CddbAlbumList,cddbalbum);
-
-                // Need to close it, if not done in Cddb_Read_Line
-                if (file)
-                    fclose(file);
-                file = NULL;
-            }
-            g_free(file_path);
-
-        }
-
+        GList *l;
 
-    }else
-    {
+        // Must block the select signal of the target to avoid looping
+        gtk_list_store_clear(priv->track_list_model);
 
-        /*
-         * Remote cddb acces
-         *
-         * Request the two servers
-         *   - 1) www.freedb.org
-         *   - 2) MusicBrainz Gateway : freedb.musicbrainz.org (in Easytag < 2.1.1, it was: 
www.mb.inhouse.co.uk)
-         */
-        while (server_try < 2)
+        for (l = g_list_first (track_list); l != NULL; l = g_list_next (l))
         {
-            server_try++;
-            if (server_try == 1)
-            {
-                // 1rst try
-                cddb_server_name     = g_strdup(CDDB_SERVER_NAME_AUTOMATIC_SEARCH);
-                cddb_server_port     = CDDB_SERVER_PORT_AUTOMATIC_SEARCH;
-                cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH);
-            }else
-            {
-                // 2sd try
-                cddb_server_name     = g_strdup(CDDB_SERVER_NAME_AUTOMATIC_SEARCH2);
-                cddb_server_port     = CDDB_SERVER_PORT_AUTOMATIC_SEARCH2;
-                cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2);
-            }
-
-            // Check values
-            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 )
-            {
-                g_free(cddb_in);
-                g_free(cddb_server_name);
-                g_free(cddb_server_cgi_path);
-                return FALSE;
-            }
-
-            // CDDB Request (ex: GET 
/~cddb/cddb.cgi?cmd=cddb+query+0800ac01+1++150+172&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?…";
-            // proto=1 => ISO-8859-1 - proto=6 => UTF-8
-            cddb_in = g_strdup_printf("GET %s%s%s?cmd=cddb+query+"
-                                      "%s+"
-                                      "%d+%s+"
-                                      "%d"
-                                      "&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,
-                                      cddb_discid,
-                                      num_tracks, query_string,
-                                      disc_length,
-                                      PACKAGE_NAME, PACKAGE_VERSION,
-                                      cddb_server_name,cddb_server_port,
-                                      (proxy_auth=Cddb_Format_Proxy_Authentification())
-                                      );
-            g_free(proxy_auth);
-            //g_print("Request Cddb_Search_Album_From_Selected_Files : '%s'\n", cddb_in);
-
-            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);
-            g_free(msg);
-
-            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(cddb_server_name);
-                g_free(cddb_server_cgi_path);
-                return FALSE;
-            }
-            g_free(cddb_in);
-            cddb_in = NULL;
-
-
-            /*
-             * 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);
-                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);
-                return FALSE;
-            }
-
-            // Parse server answer : Check returned code in the first line
-            file = NULL;
-            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);
-                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);
-                if (file)
-                    fclose(file);
-                return FALSE;
-            }
-            g_free(cddb_out);
-
-            cddb_end_str = g_strdup(".");
-
-            /*
-             * Format :
-             * For Freedb, Gnudb, the lines to read are like :
-             *      211 Found inexact matches, list follows (until terminating `.')
-             *      rock 8f0dc00b Archive / Noise
-             *      rock 7b0dd80b Archive / Noise
-             *      .
-             * 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
-            && Cddb_Read_Line(&file,&cddb_out) > 0 )
-            {
-                cddb_out_tmp = cddb_out;
-                //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 ( cddb_out_tmp && strlen(cddb_out_tmp)<=3 && strstr(cddb_out_tmp,cddb_end_str)!=NULL )
-                {
-                    g_free (cddb_out);
-                    break;
-                }
-
-                // Compatibility for the MusicBrainz CddbGateway
-                if ( cddb_out_tmp && strlen(cddb_out_tmp)>3
-                &&  (strncmp(cddb_out_tmp,"200",3)==0
-                ||   strncmp(cddb_out_tmp,"210",3)==0
-                ||   strncmp(cddb_out_tmp,"211",3)==0) )
-                    cddb_out_tmp = cddb_out_tmp + 4;
-
-                // Reading of lines with albums (skiping return code lines :
-                // "211 Found inexact matches, list follows (until terminating `.')" )
-                if (cddb_out != NULL && strstr(cddb_out_tmp,"/") != NULL)
-                {
-                    gchar* ptr;
-                    CddbAlbum *cddbalbum;
-
-                    cddbalbum = g_malloc0(sizeof(CddbAlbum));
-
-                    // Parameters of the server used
-                    cddbalbum->server_name     = g_strdup(cddb_server_name);
-                    cddbalbum->server_port     = cddb_server_port;
-                    cddbalbum->server_cgi_path = g_strdup(cddb_server_cgi_path);
-                    cddbalbum->bitmap          = Cddb_Get_Pixbuf_From_Server_Name(cddbalbum->server_name);
-
-                    // Get album category
-                    if ( (ptr = strstr(cddb_out_tmp, " ")) != NULL )
-                    {
-                        *ptr = 0;
-                        cddbalbum->category = Try_To_Validate_Utf8_String(cddb_out_tmp);
-                        *ptr = ' ';
-                        cddb_out_tmp = ptr + 1;
-                    }
-
-                    // Get album ID
-                    if ( (ptr = strstr(cddb_out_tmp, " ")) != NULL )
-                    {
-                        *ptr = 0;
-                        cddbalbum->id = Try_To_Validate_Utf8_String(cddb_out_tmp);
-                        *ptr = ' ';
-                        cddb_out_tmp = ptr + 1;
-                    }
-
-                    // Get album and artist names.
-                    cddbalbum->artist_album = Try_To_Validate_Utf8_String(cddb_out_tmp);
-
-                    CddbAlbumList = g_list_append(CddbAlbumList,cddbalbum);
-                }
+            gchar *row_text[1];
+            CddbTrackAlbum *cddbtrackalbum = l->data;
+            ET_File **etfile;
+            etfile = g_malloc0(sizeof(ET_File *));
 
-                g_free(cddb_out);
-            }
-            g_free(cddb_end_str);
-            g_free(cddb_server_name);
-            g_free(cddb_server_cgi_path);
+            row_text[0] = Convert_Duration((gulong)cddbtrackalbum->duration);
 
-            // Close file opened for reading lines
-            if (file)
-            {
-                fclose(file);
-                file = NULL;
-            }
+            /* 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);
 
-            // Close connection
-            Cddb_Close_Connection(socket_id);
+            g_free(row_text[0]);
         }
 
-    }
-
-    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);
-    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;
+        update_apply_button_sensitivity (self);
     }
 }
 
@@ -3412,8 +1943,9 @@ Cddb_Get_Album_Tracks_List_CB (GtkTreeSelection *selection, gpointer data)
  * Look up a specific album in freedb, and save to a CddbAlbum structure
  */
 static gboolean
-Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
+Cddb_Get_Album_Tracks_List (EtCDDBDialog *self, GtkTreeSelection* selection)
 {
+    EtCDDBDialogPrivate *priv;
     gint       socket_id = 0;
     CddbAlbum *cddbalbum = NULL;
     GList     *TrackOffsetList = NULL;
@@ -3429,13 +1961,13 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
     gboolean   read_track_offset = FALSE;
     GtkTreeIter row;
 
-    g_return_val_if_fail (CddbWindow != NULL, FALSE);
+    priv = et_cddb_dialog_get_instance_private (self);
 
-    gtk_list_store_clear(CddbTrackListModel);
-    Cddb_Set_Apply_Button_Sensitivity();
+    gtk_list_store_clear(priv->track_list_model);
+    update_apply_button_sensitivity (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 FALSE;
@@ -3443,7 +1975,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
     // We have already the track list
     if (cddbalbum->track_list != NULL)
     {
-        Cddb_Load_Track_Album_List(cddbalbum->track_list);
+        Cddb_Load_Track_Album_List (self, cddbalbum->track_list);
         return TRUE;
     }
 
@@ -3463,11 +1995,11 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
 
     }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 )
+        /* 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;
 
                if ( strstr(cddb_server_name,"gnudb") != NULL )
@@ -3513,12 +2045,12 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
         //g_print("Request Cddb_Get_Album_Tracks_List : '%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);
             return FALSE;
         }
@@ -3526,19 +2058,19 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
 
 
         // 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);
-            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;
         }
 
@@ -3551,7 +2083,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
                        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);
+                       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);
@@ -3566,7 +2098,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
                      || 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);
+                       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);
@@ -3580,7 +2112,7 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
     }
     cddb_end_str = g_strdup(".");
 
-    while ( CddbWindow && !CddbStopSearch
+    while ( self && !priv->stop_searching
     && Cddb_Read_Line(&file,&cddb_out) > 0 )
     {
         if (!cddb_out) // Empty line?
@@ -3746,21 +2278,20 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
 
     if (cddb_server_name)
     {
-        // Remote access
-
+        /* Remote access. */
         /* Close connection */
-        Cddb_Close_Connection(socket_id);
+        Cddb_Close_Connection (self, socket_id);
     }
 
     /* Set color of the selected row (without reloading the whole list) */
-    Cddb_Album_List_Set_Row_Appearance(&row);
+    Cddb_Album_List_Set_Row_Appearance (self, &row);
 
     /* Load the track list of the album */
-    gtk_statusbar_push(GTK_STATUSBAR(CddbStatusBar),CddbStatusBarContext,_("Loading album track list…"));
+    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(cddbalbum->track_list);
+    Cddb_Load_Track_Album_List (self, cddbalbum->track_list);
 
-    Cddb_Show_Album_Info(gtk_tree_view_get_selection(GTK_TREE_VIEW(CddbAlbumListView)),NULL);
+    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);
@@ -3769,76 +2300,40 @@ Cddb_Get_Album_Tracks_List (GtkTreeSelection* selection)
 }
 
 /*
- * 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
+ * Callback when selecting a row in the Album List.
+ * We get the list of tracks of the selected album
  */
-static void
-Cddb_Album_List_Set_Row_Appearance (GtkTreeIter *row)
+static gboolean
+Cddb_Get_Album_Tracks_List_CB (EtCDDBDialog *self, GtkTreeSelection *selection)
 {
-    CddbAlbum *cddbalbum = NULL;
-
-    gtk_tree_model_get(GTK_TREE_MODEL(CddbAlbumListModel), row,
-                       CDDB_ALBUM_LIST_DATA, &cddbalbum, -1);
+    gint i;
+    gint i_max = 5;
 
-    if (cddbalbum->track_list != NULL)
+    /* 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 (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 (Cddb_Get_Album_Tracks_List (self, selection) == TRUE)
         {
-            if (cddbalbum->other_version == TRUE)
-            {
-                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);
-            }
+            break;
         }
+    }
+    if (i <= i_max)
+    {
+        return TRUE;
     } 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
-            {
-                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);
-        }
+        return FALSE;
     }
 }
 
-
 /*
  * Set CDDB data (from tracks list) into tags of the main file list
  */
 static gboolean
-Cddb_Set_Track_Infos_To_File_List (void)
+Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
 {
+    EtCDDBDialogPrivate *priv;
     guint row;
     guint list_length;
     guint rows_to_loop = 0;
@@ -3861,30 +2356,32 @@ Cddb_Set_Track_Infos_To_File_List (void)
     GtkTreeIter *fileIter;
     gpointer iterptr;
 
-    g_return_val_if_fail (CddbWindow != NULL && BrowserList != NULL
+    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(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));
+    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(CddbTrackListModel), NULL);
+    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(CddbTrackListView));
+    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. */
@@ -3950,7 +2447,7 @@ Cddb_Set_Track_Infos_To_File_List (void)
         GtkWidget *msgdialog;
         gint response;
 
-        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_QUESTION,
                                            GTK_BUTTONS_NONE,
@@ -3995,10 +2492,10 @@ Cddb_Set_Track_Infos_To_File_List (void)
             }
         }
 
-        if (gtk_tree_model_get_iter (GTK_TREE_MODEL (CddbTrackListModel),
+        if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->track_list_model),
                                      &currentIter, currentPath))
         {
-            gtk_tree_model_get (GTK_TREE_MODEL (CddbTrackListModel),
+            gtk_tree_model_get (GTK_TREE_MODEL (priv->track_list_model),
                                 &currentIter, CDDB_TRACK_LIST_DATA,
                                 &cddbtrackalbum, -1);
         }
@@ -4015,7 +2512,7 @@ Cddb_Set_Track_Infos_To_File_List (void)
             File_Name *FileName = NULL;
             File_Tag *FileTag = NULL;
 
-            gtk_tree_model_get(GTK_TREE_MODEL(CddbTrackListModel), &currentIter,
+            gtk_tree_model_get(GTK_TREE_MODEL(priv->track_list_model), &currentIter,
                                CDDB_TRACK_LIST_ETFILE, &etfile, -1);
 
             /*
@@ -4093,11 +2590,13 @@ Cddb_Set_Track_Infos_To_File_List (void)
 
             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)
+            /* 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;
@@ -4181,9 +2680,11 @@ Cddb_Set_Track_Infos_To_File_List (void)
 
             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);
+            /* 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;
@@ -4198,24 +2699,1593 @@ Cddb_Set_Track_Infos_To_File_List (void)
     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
-Cddb_Display_Red_Lines_In_Result (void)
+track_list_select_all (EtCDDBDialog *self)
 {
-    g_return_if_fail (CddbDisplayRedLinesButton != NULL);
+    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_COLOR);
+    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-gdk", 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-gdk", 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"));
+
+    /* TODO: Avoid showing the dialog at this stage. */
+    gtk_widget_show_all (GTK_WIDGET (self));
+
+    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);
+    }
 
-    if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(CddbDisplayRedLinesButton)) )
+    result = fgets(buffer,sizeof(buffer),*file);
+    if (result != NULL)
     {
-        // Show only red lines
-        Cddb_Load_Album_List(TRUE);
+       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
     {
-        // Show all lines
-        Cddb_Load_Album_List(FALSE);
+        // 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.
+ */
+gboolean
+et_cddb_dialog_search_from_selection (EtCDDBDialog *self)
+{
+    EtCDDBDialogPrivate *priv;
+    gint   socket_id;
+    gint   bytes_written;
+    gulong bytes_read_total = 0;
+    FILE  *file = NULL;
+
+    gchar *cddb_in = NULL; /* For the request to send. */
+    gchar *cddb_out = NULL;       /* Answer received */
+    gchar *cddb_out_tmp;
+    gchar *msg;
+    gchar *proxy_auth;
+    gchar *cddb_server_name;
+    gint   cddb_server_port;
+    gchar *cddb_server_cgi_path;
+    gint   server_try = 0;
+    gchar *tmp, *valid;
+    gchar *query_string;
+    gchar *cddb_discid;
+    gchar *cddb_end_str;
+
+    guint total_frames = 150;   /* First offset is (almost) always 150 */
+    guint disc_length  = 2;     /* and 2s elapsed before first track */
+
+    GtkTreeSelection *file_selection = NULL;
+    guint file_selectedcount = 0;
+    GtkTreeIter  currentIter;
+    guint total_id;
+    guint num_tracks;
+
+    gpointer iterptr;
+
+    GtkListStore *fileListModel;
+    GtkTreeIter *fileIter;
+    GList *file_iterlist = NULL;
+    GList *l;
+
+    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));
+    file_selectedcount = gtk_tree_selection_count_selected_rows(file_selection);
+
+    // Create the list 'file_iterlist' of selected files (no selected files => all files selected)
+    if (file_selectedcount > 0)
+    {
+        GList* file_selectedrows = gtk_tree_selection_get_selected_rows(file_selection, NULL);
+
+        for (l = file_selectedrows; l != NULL; l = g_list_next (l))
+        {
+            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);
+            }
+        }
+        g_list_free_full (file_selectedrows,
+                          (GDestroyNotify)gtk_tree_path_free);
+
+    } else /* No rows selected, use the whole list */
+    {
+        gtk_tree_model_get_iter_first(GTK_TREE_MODEL(fileListModel), &currentIter);
+
+        do
+        {
+            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 == 0)
+    {
+        msg = g_strdup_printf(_("No file selected"));
+        gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
+        g_free(msg);
+        return TRUE;
+    }else if (file_selectedcount > 99)
+    {
+        // 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(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(priv->status_bar),priv->status_bar_context,msg);
+        g_free(msg);
+    }
+
+    // Generate query string and compute discid from the list 'file_iterlist'
+    total_id = 0;
+    num_tracks = file_selectedcount;
+    query_string = g_strdup("");
+
+    for (l = g_list_reverse (file_iterlist); l != NULL; l = g_list_next (l))
+    {
+        ET_File *etfile;
+        gulong secs = 0;
+
+        fileIter = (GtkTreeIter *)l->data;
+        etfile = Browser_List_Get_ETFile_From_Iter(fileIter);
+
+        tmp = query_string;
+        if (strlen(query_string)>0)
+            query_string = g_strdup_printf("%s+%d", query_string, total_frames);
+        else
+            query_string = g_strdup_printf("%d", total_frames);
+        g_free(tmp);
+
+        secs = etfile->ETFileInfo->duration;
+        total_frames += secs * 75;
+        disc_length  += secs;
+        while (secs > 0)
+        {
+            total_id = total_id + (secs % 10);
+            secs = secs / 10;
+        }
+    }
+
+    g_list_free_full (file_iterlist, (GDestroyNotify)g_free);
+
+    // Compute CddbId
+    cddb_discid = g_strdup_printf("%08x",(guint)(((total_id % 0xFF) << 24) |
+                                         (disc_length << 8) | num_tracks));
+
+
+    // Delete previous album list
+    gtk_list_store_clear(priv->album_list_model);
+    gtk_list_store_clear(priv->track_list_model);
+    if (priv->album_list)
+    {
+        Cddb_Free_Album_List (self);
+    }
+    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(priv->use_local_access_toggle));
+    if (CDDB_USE_LOCAL_ACCESS) // Remote or Local acces?
+    {
+        /*
+         * Local cddb acces
+         */
+        static const gchar *CddbDir[] = // Or use cddb_genre_vs_id3_genre[][2]?
+        {
+            "blues", "classical", "country", "data",   "folk",
+            "jazz",  "misc",      "newage",  "reggae", "rock",
+            "soundtrack"
+        };
+        static const gsize CddbDirSize = G_N_ELEMENTS (CddbDir) - 1;
+        gsize i;
+
+        // We check if the file corresponding to the discid exists in each directory
+        for (i=0; i<=CddbDirSize; i++)
+        {
+            gchar *file_path;
+
+            if (!CDDB_LOCAL_PATH || strlen(CDDB_LOCAL_PATH)==0)
+            {
+                GtkWidget *msgdialog;
+
+                msgdialog = gtk_message_dialog_new(GTK_WINDOW(self),
+                                                   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                   GTK_MESSAGE_ERROR,
+                                                   GTK_BUTTONS_CLOSE,
+                                                   "%s",
+                                                   _("The path for 'Local CD Database' was not defined"));
+                /* Translators: 'it' in this sentence refers to the local CD
+                 * database path. */
+                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(msgdialog), "%s", _("Enter it in 
the preferences window before using this search."));
+                gtk_window_set_title (GTK_WINDOW (msgdialog),
+                                      _("Local CD search"));
+
+                gtk_dialog_run(GTK_DIALOG(msgdialog));
+                gtk_widget_destroy(msgdialog);
+                break;
+            }
+            file_path = g_strconcat(CDDB_LOCAL_PATH,
+                                    CDDB_LOCAL_PATH[strlen(CDDB_LOCAL_PATH)-1]!=G_DIR_SEPARATOR ? 
G_DIR_SEPARATOR_S : "",
+                                    CddbDir[i],"/",cddb_discid,NULL);
+
+            if ( (file=fopen(file_path,"r"))!=0 )
+            {
+                // File found
+                CddbAlbum *cddbalbum;
+                gint rc = 0;
+
+                cddbalbum = g_malloc0(sizeof(CddbAlbum));
+
+                // Parameters of the server used (Local acces => specific!)
+                cddbalbum->server_name     = NULL;                // No server name
+                cddbalbum->server_port     = 0;                   // No server port
+                cddbalbum->server_cgi_path = g_strdup(file_path); /* Filename. */
+                cddbalbum->bitmap          = Cddb_Get_Pixbuf_From_Server_Name(file_path);
+
+                // Get album category
+                cddbalbum->category = Try_To_Validate_Utf8_String(CddbDir[i]);
+
+                // Get album ID
+                cddbalbum->id = Try_To_Validate_Utf8_String(cddb_discid);
+
+                while ( self && !priv->stop_searching
+                && (rc = Cddb_Read_Line(&file,&cddb_out)) > 0 )
+                {
+                    if (!cddb_out) // Empty line?
+                        continue;
+                    //g_print("%s\n",cddb_out);
+
+                    // Get Album and Artist names
+                    if ( strncmp(cddb_out,"DTITLE=",7)==0 )
+                    {
+                        // 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->artist_album)
+                        {
+                            // It is the first time we find DTITLE...
+
+                            // Artist and album
+                            cddbalbum->artist_album = 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
+
+                            // Album
+                            valid = Try_To_Validate_Utf8_String(cddb_out+7); // '7' to skip 'DTITLE='
+                            tmp = cddbalbum->artist_album; // To free...
+                            cddbalbum->artist_album = g_strconcat(cddbalbum->artist_album,valid,NULL);
+                            g_free(tmp);
+
+                            // Don't need to read more data to read in the file
+                            break;
+                        }
+                    }
+
+                    g_free(cddb_out);
+                }
+
+                priv->album_list = g_list_append(priv->album_list,cddbalbum);
+
+                // Need to close it, if not done in Cddb_Read_Line
+                if (file)
+                    fclose(file);
+                file = NULL;
+            }
+            g_free(file_path);
+
+        }
+
+
+    }else
+    {
+
+        /*
+         * Remote cddb acces
+         *
+         * Request the two servers
+         *   - 1) www.freedb.org
+         *   - 2) MusicBrainz Gateway : freedb.musicbrainz.org (in Easytag < 2.1.1, it was: 
www.mb.inhouse.co.uk)
+         */
+        while (server_try < 2)
+        {
+            server_try++;
+            if (server_try == 1)
+            {
+                // 1rst try
+                cddb_server_name     = g_strdup(CDDB_SERVER_NAME_AUTOMATIC_SEARCH);
+                cddb_server_port     = CDDB_SERVER_PORT_AUTOMATIC_SEARCH;
+                cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH);
+            }else
+            {
+                // 2sd try
+                cddb_server_name     = g_strdup(CDDB_SERVER_NAME_AUTOMATIC_SEARCH2);
+                cddb_server_port     = CDDB_SERVER_PORT_AUTOMATIC_SEARCH2;
+                cddb_server_cgi_path = g_strdup(CDDB_SERVER_CGI_PATH_AUTOMATIC_SEARCH2);
+            }
+
+            // Check values
+            if (!cddb_server_name || strcmp(cddb_server_name,"")==0)
+                continue;
+
+            /* 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);
+                g_free(cddb_server_cgi_path);
+                return FALSE;
+            }
+
+            // CDDB Request (ex: GET 
/~cddb/cddb.cgi?cmd=cddb+query+0800ac01+1++150+172&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?…";
+            // proto=1 => ISO-8859-1 - proto=6 => UTF-8
+            cddb_in = g_strdup_printf("GET %s%s%s?cmd=cddb+query+"
+                                      "%s+"
+                                      "%d+%s+"
+                                      "%d"
+                                      "&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,
+                                      cddb_discid,
+                                      num_tracks, query_string,
+                                      disc_length,
+                                      PACKAGE_NAME, PACKAGE_VERSION,
+                                      cddb_server_name,cddb_server_port,
+                                      (proxy_auth=Cddb_Format_Proxy_Authentification())
+                                      );
+            g_free(proxy_auth);
+            //g_print("Request Cddb_Search_Album_From_Selected_Files : '%s'\n", cddb_in);
+
+            msg = g_strdup_printf(_("Sending request (CddbId: %s, #tracks: %d, Disc length: %d)…"),
+                                cddb_discid,num_tracks,disc_length);
+            gtk_statusbar_push(GTK_STATUSBAR(priv->status_bar),priv->status_bar_context,msg);
+            g_free(msg);
+
+            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);
+                g_free (cddb_server_name);
+                g_free (cddb_server_cgi_path);
+                return FALSE;
+            }
+            g_free(cddb_in);
+            cddb_in = NULL;
+
+
+            /*
+             * Read the answer
+             */
+            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 (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);
+                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;
+            }
+
+            // Parse server answer : Check returned code in the first line
+            file = NULL;
+            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(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(priv->stop_search_button),FALSE);
+                gtk_widget_set_sensitive(GTK_WIDGET(priv->stop_auto_search_button),FALSE);
+                if (file)
+                    fclose(file);
+                return FALSE;
+            }
+            g_free(cddb_out);
+
+            cddb_end_str = g_strdup(".");
+
+            /*
+             * Format :
+             * For Freedb, Gnudb, the lines to read are like :
+             *      211 Found inexact matches, list follows (until terminating `.')
+             *      rock 8f0dc00b Archive / Noise
+             *      rock 7b0dd80b Archive / Noise
+             *      .
+             * 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 ( self && !priv->stop_searching
+            && Cddb_Read_Line(&file,&cddb_out) > 0 )
+            {
+                cddb_out_tmp = cddb_out;
+                //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 ( cddb_out_tmp && strlen(cddb_out_tmp)<=3 && strstr(cddb_out_tmp,cddb_end_str)!=NULL )
+                {
+                    g_free (cddb_out);
+                    break;
+                }
+
+                // Compatibility for the MusicBrainz CddbGateway
+                if ( cddb_out_tmp && strlen(cddb_out_tmp)>3
+                &&  (strncmp(cddb_out_tmp,"200",3)==0
+                ||   strncmp(cddb_out_tmp,"210",3)==0
+                ||   strncmp(cddb_out_tmp,"211",3)==0) )
+                    cddb_out_tmp = cddb_out_tmp + 4;
+
+                // Reading of lines with albums (skiping return code lines :
+                // "211 Found inexact matches, list follows (until terminating `.')" )
+                if (cddb_out != NULL && strstr(cddb_out_tmp,"/") != NULL)
+                {
+                    gchar* ptr;
+                    CddbAlbum *cddbalbum;
+
+                    cddbalbum = g_malloc0(sizeof(CddbAlbum));
+
+                    // Parameters of the server used
+                    cddbalbum->server_name     = g_strdup(cddb_server_name);
+                    cddbalbum->server_port     = cddb_server_port;
+                    cddbalbum->server_cgi_path = g_strdup(cddb_server_cgi_path);
+                    cddbalbum->bitmap          = Cddb_Get_Pixbuf_From_Server_Name(cddbalbum->server_name);
+
+                    // Get album category
+                    if ( (ptr = strstr(cddb_out_tmp, " ")) != NULL )
+                    {
+                        *ptr = 0;
+                        cddbalbum->category = Try_To_Validate_Utf8_String(cddb_out_tmp);
+                        *ptr = ' ';
+                        cddb_out_tmp = ptr + 1;
+                    }
+
+                    // Get album ID
+                    if ( (ptr = strstr(cddb_out_tmp, " ")) != NULL )
+                    {
+                        *ptr = 0;
+                        cddbalbum->id = Try_To_Validate_Utf8_String(cddb_out_tmp);
+                        *ptr = ' ';
+                        cddb_out_tmp = ptr + 1;
+                    }
+
+                    // Get album and artist names.
+                    cddbalbum->artist_album = Try_To_Validate_Utf8_String(cddb_out_tmp);
+
+                    priv->album_list = g_list_append(priv->album_list,cddbalbum);
+                }
+
+                g_free(cddb_out);
+            }
+            g_free(cddb_end_str);
+            g_free(cddb_server_name);
+            g_free(cddb_server_cgi_path);
+
+            /* Close file opened for reading lines. */
+            if (file)
+            {
+                fclose(file);
+                file = NULL;
+            }
+
+            /* 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(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 (priv->stop_search_button), FALSE);
+    gtk_widget_set_sensitive (GTK_WIDGET (priv->stop_auto_search_button),
+                                 FALSE);
+
+    /* Initialize the button. */
+    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;
+}
+
 /*
  * Returns the corresponding ID3 genre (the name, not the value)
  */
@@ -4278,3 +4348,50 @@ 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);
+
+    gtk_widget_show_all (GTK_WIDGET (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 0271b7b..6de1777 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -44,6 +44,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"
 
@@ -173,7 +173,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 0559795..4924891 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 a06de0e..2ccff23 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.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]