[easytag/wip/application-window: 6/71] Move scan dialog to EtScanDialog object



commit ff48b1a8996f5a9745482660e67d6ee4003992a2
Author: David King <amigadave amigadave com>
Date:   Sun Dec 29 23:15:26 2013 +0000

    Move scan dialog to EtScanDialog object

 TODO                     |    4 -
 src/application_window.c |  101 ++-
 src/application_window.h |    4 +
 src/bar.c                |   12 +-
 src/browser.c            |    1 -
 src/cddb_dialog.c        |   23 +-
 src/easytag.c            |  159 +--
 src/easytag.h            |    2 +-
 src/load_files_dialog.c  |   16 +-
 src/misc.c               |    2 -
 src/playlist_dialog.c    |    2 +-
 src/preferences_dialog.c |    2 +-
 src/scan.h               |    4 +
 src/scan_dialog.c        | 3192 ++++++++++++++++++++++++----------------------
 src/scan_dialog.h        |   75 +-
 src/search_dialog.c      |    2 +-
 src/setting.c            |   19 +-
 src/setting.h            |    3 -
 18 files changed, 1867 insertions(+), 1756 deletions(-)
---
diff --git a/TODO b/TODO
index e6b67ea..0b6d1c9 100644
--- a/TODO
+++ b/TODO
@@ -4,16 +4,12 @@ TODO List
 General tidying
 ---------------
 
-* Convert user guide to help in Mallard
-* Avoid using GdkWindow all over the place
-** Drop the window moving and size restoring code
 * Use PNG icons and drop the XPM ones
 * Use GProxyResolver for proxy settings
 * Port configuration settings to use GSettings
 * Port file I/O to use GFile from GIO
 ** Additionally, make I/O asynchronous
 ** Always use the GLib encoding for filenames (convert for display)
-* Instantiate windows on first use, not at startup
 * GObjectification
 * Avoid using gtk_events_pending(), use asynchronous operations instead
 
diff --git a/src/application_window.c b/src/application_window.c
index 11d21ec..dc50fad 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -53,6 +53,7 @@ struct _EtApplicationWindowPrivate
     GtkWidget *load_files_dialog;
     GtkWidget *playlist_dialog;
     GtkWidget *preferences_dialog;
+    GtkWidget *scan_dialog;
     GtkWidget *search_dialog;
 
     /* Tag area labels. */
@@ -162,9 +163,13 @@ Convert_Letter_Uppercase (GtkWidget *entry)
 static void
 Convert_First_Letters_Uppercase (GtkWidget *entry)
 {
-    gchar *string = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+    EtScanDialog *dialog;
+    gchar *string;
+
+    string = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
+    dialog = ET_SCAN_DIALOG (et_application_window_get_scan_dialog (ET_APPLICATION_WINDOW (MainWindow)));
 
-    Scan_Process_Fields_First_Letters_Uppercase (&string);
+    Scan_Process_Fields_First_Letters_Uppercase (dialog, &string);
     gtk_entry_set_text (GTK_ENTRY (entry), string);
     g_free (string);
 }
@@ -1651,6 +1656,7 @@ et_application_window_finalize (GObject *object)
     g_clear_object (&priv->load_files_dialog);
     g_clear_object (&priv->playlist_dialog);
     g_clear_object (&priv->preferences_dialog);
+    g_clear_object (&priv->scan_dialog);
     g_clear_object (&priv->search_dialog);
 
     G_OBJECT_CLASS (et_application_window_parent_class)->finalize (object);
@@ -1673,6 +1679,7 @@ et_application_window_init (EtApplicationWindow *self)
     priv->load_files_dialog = NULL;
     priv->playlist_dialog = NULL;
     priv->preferences_dialog = NULL;
+    priv->scan_dialog = NULL;
     priv->search_dialog = NULL;
 
     window = GTK_WINDOW (self);
@@ -1993,6 +2000,96 @@ et_application_window_search_cddb_for_selection (G_GNUC_UNUSED GtkAction *action
     et_cddb_dialog_search_from_selection (ET_CDDB_DIALOG (priv->cddb_dialog));
 }
 
+GtkWidget *
+et_application_window_get_scan_dialog (EtApplicationWindow *self)
+{
+    EtApplicationWindowPrivate *priv;
+
+    g_return_val_if_fail (self != NULL, NULL);
+
+    priv = et_application_window_get_instance_private (self);
+
+    return priv->scan_dialog;
+}
+
+void
+et_application_window_show_scan_dialog (GtkAction *action, gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    gboolean active;
+    EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
+
+    priv = et_application_window_get_instance_private (self);
+    active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
+
+    if (!active)
+    {
+        if (priv->scan_dialog)
+        {
+            gtk_widget_hide (priv->scan_dialog);
+        }
+        else
+        {
+            return;
+        }
+    }
+    else
+    {
+        if (priv->scan_dialog)
+        {
+            gtk_widget_show (priv->scan_dialog);
+        }
+        else
+        {
+            priv->scan_dialog = GTK_WIDGET (et_scan_dialog_new ());
+            gtk_widget_show (priv->scan_dialog);
+        }
+    }
+}
+
+/*
+ * Action when Scan button is pressed
+ */
+void
+et_application_window_scan_selected_files (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_scan_dialog_scan_selected_files (ET_SCAN_DIALOG (priv->scan_dialog));
+}
+
+/*
+ * et_on_action_select_scan_mode:
+ * @action: the action on which the signal was emitted
+ * @current: the member of the action group which has just been activated
+ * @user_data: user data set when the signal handler was connected
+ *
+ * Select the current scanner mode and open the scanner window.
+ */
+void
+et_on_action_select_scan_mode (GtkRadioAction *action, GtkRadioAction *current,
+                               gpointer user_data)
+{
+    EtApplicationWindowPrivate *priv;
+    EtApplicationWindow *self = ET_APPLICATION_WINDOW (user_data);
+    gint active_value;
+
+    priv = et_application_window_get_instance_private (self);
+
+    active_value = gtk_radio_action_get_current_value (action);
+
+    if (SCANNER_TYPE != active_value)
+    {
+        SCANNER_TYPE = active_value;
+    }
+
+    et_scan_dialog_open (ET_SCAN_DIALOG (priv->scan_dialog), SCANNER_TYPE);
+}
+
 /*
  * Disable (FALSE) / Enable (TRUE) all user widgets in the tag area
  */
diff --git a/src/application_window.h b/src/application_window.h
index e5b5545..aaf9583 100644
--- a/src/application_window.h
+++ b/src/application_window.h
@@ -63,6 +63,10 @@ void et_application_window_show_preferences_dialog_scanner (GtkAction *action, g
 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);
+GtkWidget * et_application_window_get_scan_dialog (EtApplicationWindow *self);
+void et_application_window_show_scan_dialog (GtkAction *action, gpointer user_data);
+void et_application_window_scan_selected_files (GtkAction *action, gpointer user_data);
+void et_on_action_select_scan_mode (GtkRadioAction *action, GtkRadioAction *current, 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 af14e09..c9f1f51 100644
--- a/src/bar.c
+++ b/src/bar.c
@@ -224,7 +224,8 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { AM_LAST, GTK_STOCK_GOTO_LAST, _("_Last File"), "<Primary>End",
           _("Last file"), G_CALLBACK (Action_Select_Last_File) },
         { AM_SCAN_FILES, GTK_STOCK_APPLY, _("S_can Files"), NULL,
-          _("Scan selected files"), G_CALLBACK (Action_Scan_Selected_Files) },
+          _("Scan selected files"),
+          G_CALLBACK (et_application_window_scan_selected_files) },
         { AM_REMOVE, GTK_STOCK_CLEAR, _("_Remove Tags"), "<Primary>E",
           _("Remove tags"), G_CALLBACK (Action_Remove_Selected_Tags) },
         { AM_UNDO, GTK_STOCK_UNDO, _("_Undo Last Files Changes"), "<Primary>Z",
@@ -353,7 +354,8 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
         { AM_BROWSER_HIDDEN_DIR, NULL,                   _("Show Hidden Directories"),                       
  NULL, _("Show hidden directories"),                         G_CALLBACK(Browser_Tree_Rebuild),     
BROWSE_HIDDEN_DIR },
 #endif /* !G_OS_WIN32 */
         { AM_SCANNER_SHOW, "document-properties", _("_Show Scanner"), NULL,
-          _("Show scanner"), G_CALLBACK (et_scan_show),
+          _("Show scanner"),
+          G_CALLBACK (et_application_window_show_scan_dialog),
           OPEN_SCANNER_WINDOW_ON_STARTUP },
     };
 
@@ -369,13 +371,13 @@ Create_UI (GtkWindow *window, GtkWidget **ppmenubar, GtkWidget **pptoolbar)
     GtkRadioActionEntry scanner_mode_entries[] =
     {
         { AM_SCANNER_FILL_TAG, "document-properties", _("_Fill Tags…"), NULL,
-          _("Fill tags"), SCANNER_FILL_TAG },
+          _("Fill tags"), ET_SCAN_TYPE_FILL_TAG },
         { AM_SCANNER_RENAME_FILE, "document-properties",
           _("_Rename Files and Directories…"), NULL,
-          _("Rename files and directories"), SCANNER_RENAME_FILE },
+          _("Rename files and directories"), ET_SCAN_TYPE_RENAME_FILE },
         { AM_SCANNER_PROCESS_FIELDS, "document-properties",
           _("_Process Fields…"), NULL, _("Process Fields"),
-          SCANNER_PROCESS_FIELDS }
+          ET_SCAN_TYPE_PROCESS_FIELDS }
     };
 
     GError *error = NULL;
diff --git a/src/browser.c b/src/browser.c
index eb06cd0..849255e 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -1,4 +1,3 @@
-/* browser.c - 2000/04/28 */
 /*
  *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
  *  Copyright (C) 2000-2003  Jerome Couderc <easytag gmail com>
diff --git a/src/cddb_dialog.c b/src/cddb_dialog.c
index 9f33a21..d0e050a 100644
--- a/src/cddb_dialog.c
+++ b/src/cddb_dialog.c
@@ -39,6 +39,7 @@
 #include <errno.h>
 
 #include "gtk2_compat.h"
+#include "application_window.h"
 #include "cddb_dialog.h"
 #include "easytag.h"
 #include "et_core.h"
@@ -2648,9 +2649,16 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
             ET_Manage_Changes_Of_File_Data(*etfile,FileName,FileTag);
 
             /* Then run current scanner if requested. */
-            if (ScannerWindow && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
+            if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
             {
-                Scan_Select_Mode_And_Run_Scanner (*etfile);
+                EtScanDialog *dialog;
+
+                dialog = ET_SCAN_DIALOG (et_application_window_get_scan_dialog (ET_APPLICATION_WINDOW 
(MainWindow)));
+
+                if (dialog)
+                {
+                    Scan_Select_Mode_And_Run_Scanner (dialog, *etfile);
+                }
             }
         }
         else if (cddbtrackalbum && file_iterlist && file_iterlist->data)
@@ -2738,9 +2746,16 @@ Cddb_Set_Track_Infos_To_File_List (EtCDDBDialog *self)
             ET_Manage_Changes_Of_File_Data(etfile,FileName,FileTag);
 
             /* Then run current scanner if requested. */
-            if (ScannerWindow && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
+            if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->run_scanner_toggle)))
             {
-                Scan_Select_Mode_And_Run_Scanner (etfile);
+                EtScanDialog *dialog;
+
+                dialog = ET_SCAN_DIALOG (et_application_window_get_scan_dialog (ET_APPLICATION_WINDOW 
(MainWindow)));
+
+                if (dialog)
+                {
+                    Scan_Select_Mode_And_Run_Scanner (dialog, etfile);
+                }
             }
         }
 
diff --git a/src/easytag.c b/src/easytag.c
index 61a9938..4a0d777 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -39,6 +39,7 @@
 #include "gtk2_compat.h"
 #include "easytag.h"
 #include "application.h"
+#include "application_window.h"
 #include "browser.h"
 #include "log.h"
 #include "misc.h"
@@ -46,7 +47,6 @@
 #include "cddb_dialog.h"
 #include "preferences_dialog.h"
 #include "setting.h"
-#include "scan.h"
 #include "scan_dialog.h"
 #include "mpeg_header.h"
 #include "id3_tag.h"
@@ -86,7 +86,6 @@ static gint SF_ButtonPressed_Delete_File;
 /**************
  * Prototypes *
  **************/
-static void Disable_Command_Buttons (void);
 static gboolean Write_File_Tag (ET_File *ETFile, gboolean hide_msgbox);
 static gint Save_File (ET_File *ETFile, gboolean multiple_files,
                        gboolean force_saving_files);
@@ -135,7 +134,6 @@ common_init (GApplication *application)
     Main_Stop_Button_Pressed = FALSE;
     Init_Custom_Icons();
     Init_Mouse_Cursor();
-    Init_ScannerWindow();
     BrowserEntryModel    = NULL;
     TrackEntryComboModel = NULL;
     GenreComboModel      = NULL;
@@ -538,8 +536,7 @@ void Action_Select_First_File (void)
     }
 
     Update_Command_Buttons_Sensivity();
-    Scan_Rename_File_Generate_Preview();
-    Scan_Fill_Tag_Generate_Preview();
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
     if (SET_FOCUS_TO_FIRST_TAG_FIELD)
         gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
@@ -572,8 +569,7 @@ void Action_Select_Prev_File (void)
 //        gdk_beep(); // Warm the user
 
     Update_Command_Buttons_Sensivity();
-    Scan_Rename_File_Generate_Preview();
-    Scan_Fill_Tag_Generate_Preview();
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
     if (SET_FOCUS_TO_FIRST_TAG_FIELD)
         gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
@@ -606,8 +602,7 @@ void Action_Select_Next_File (void)
 //        gdk_beep(); // Warm the user
 
     Update_Command_Buttons_Sensivity();
-    Scan_Rename_File_Generate_Preview();
-    Scan_Fill_Tag_Generate_Preview();
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
     if (SET_FOCUS_TO_FIRST_TAG_FIELD)
         gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
@@ -637,8 +632,7 @@ void Action_Select_Last_File (void)
     }
 
     Update_Command_Buttons_Sensivity();
-    Scan_Rename_File_Generate_Preview();
-    Scan_Fill_Tag_Generate_Preview();
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
     if (SET_FOCUS_TO_FIRST_TAG_FIELD)
         gtk_widget_grab_focus(GTK_WIDGET(TitleEntry));
@@ -662,89 +656,9 @@ void Action_Select_Nth_File_By_Etfile (ET_File *ETFile)
     ET_Display_File_Data_To_UI(ETFile);
 
     Update_Command_Buttons_Sensivity();
-    Scan_Rename_File_Generate_Preview();
-    Scan_Fill_Tag_Generate_Preview();
+    et_scan_dialog_update_previews (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 }
 
-
-/*
- * Action when Scan button is pressed
- */
-void Action_Scan_Selected_Files (void)
-{
-    gint progress_bar_index;
-    gint selectcount;
-    gchar progress_bar_text[30];
-    double fraction;
-    GList *selfilelist = NULL;
-    GList *l;
-    ET_File *etfile;
-    GtkTreeSelection *selection;
-
-    g_return_if_fail (ETCore->ETFileDisplayedList != NULL ||
-                      BrowserList != NULL);
-
-    /* Check if scanner window is opened */
-    if (!ScannerWindow)
-    {
-        Open_ScannerWindow(SCANNER_TYPE);
-        Statusbar_Message(_("Select Mode and Mask, and redo the same action"),TRUE);
-        return;
-    }
-
-    /* Save the current displayed data */
-    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
-
-    /* Initialize status bar */
-    selectcount = 
gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList)));
-    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar),0);
-    progress_bar_index = 0;
-    g_snprintf(progress_bar_text, 30, "%d/%d", progress_bar_index, selectcount);
-    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
-
-    /* Set to unsensitive all command buttons (except Quit button) */
-    Disable_Command_Buttons();
-
-    progress_bar_index = 0;
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
-    selfilelist = gtk_tree_selection_get_selected_rows(selection, NULL);
-
-    for (l = selfilelist; l != NULL; l = g_list_next (l))
-    {
-        etfile = Browser_List_Get_ETFile_From_Path (l->data);
-
-        // Run the current scanner
-        Scan_Select_Mode_And_Run_Scanner(etfile);
-
-        fraction = (++progress_bar_index) / (double) selectcount;
-        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), fraction);
-        g_snprintf(progress_bar_text, 30, "%d/%d", progress_bar_index, selectcount);
-        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
-
-        /* Needed to refresh status bar */
-        while (gtk_events_pending())
-            gtk_main_iteration();
-    }
-
-    g_list_free_full (selfilelist, (GDestroyNotify)gtk_tree_path_free);
-
-    // Refresh the whole list (faster than file by file) to show changes
-    Browser_List_Refresh_Whole_List();
-
-    /* Display the current file */
-    ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
-
-    /* To update state of command buttons */
-    Update_Command_Buttons_Sensivity();
-
-    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), "");
-    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), 0);
-    Statusbar_Message(_("All tags have been scanned"),TRUE);
-}
-
-
-
 /*
  * Action when Remove button is pressed
  */
@@ -1938,31 +1852,6 @@ Action_Select_Browser_Style (void)
 }
 
 /*
- * et_on_action_select_scan_mode:
- * @action: the action on which the signal was emitted
- * @current: the member of the action group which has just been activated
- * @user_data: user data set when the signal handler was connected
- *
- * Select the current scanner mode and open the scanner window.
- */
-void
-et_on_action_select_scan_mode (GtkRadioAction *action, GtkRadioAction *current,
-                               gpointer user_data)
-{
-    gint active_value;
-
-    active_value = gtk_radio_action_get_current_value (action);
-
-    if (SCANNER_TYPE != active_value)
-    {
-        SCANNER_TYPE = active_value;
-    }
-
-    Open_ScannerWindow (SCANNER_TYPE);
-}
-
-
-/*
  * Scans the specified directory: and load files into a list.
  * If the path doesn't exist, we free the previous loaded list of files.
  */
@@ -2358,12 +2247,15 @@ ui_widget_set_sensitive (const gchar *menu, const gchar *action, gboolean sensit
  * Update_Command_Buttons_Sensivity: Set to sensitive/unsensitive the state of each button into
  * the commands area and menu items in function of state of the "main list".
  */
-void Update_Command_Buttons_Sensivity (void)
+void
+Update_Command_Buttons_Sensivity (void)
 {
     EtApplicationWindow *window;
+    GtkDialog *dialog;
     GtkAction *uiaction;
 
     window = ET_APPLICATION_WINDOW (MainWindow);
+    dialog = GTK_DIALOG (et_application_window_get_scan_dialog (window));
 
     if (!ETCore->ETFileDisplayedList)
     {
@@ -2378,10 +2270,10 @@ void Update_Command_Buttons_Sensivity (void)
         g_object_set(uiaction, "sensitive", FALSE, NULL);
 
         /* Scanner Window */
-        if (ScannerWindow)
+        if (dialog)
         {
-            gtk_dialog_set_response_sensitive (GTK_DIALOG (ScannerWindow),
-                                               GTK_RESPONSE_APPLY, FALSE);
+            gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY,
+                                               FALSE);
         }
 
         /* Menu commands */
@@ -2459,10 +2351,10 @@ void Update_Command_Buttons_Sensivity (void)
         g_object_set(uiaction, "sensitive", FALSE, NULL);
 
         /* Scanner Window */
-        if (ScannerWindow)
+        if (dialog)
         {
-            gtk_dialog_set_response_sensitive (GTK_DIALOG (ScannerWindow),
-                                               GTK_RESPONSE_APPLY, TRUE);
+            gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY,
+                                               TRUE);
         }
 
         /* Commands into menu */
@@ -2602,14 +2494,17 @@ void Update_Command_Buttons_Sensivity (void)
 /*
  * Just to disable buttons when we are saving files (do not disable Quit button)
  */
-static void
+void
 Disable_Command_Buttons (void)
 {
+    GtkDialog *dialog;
+
+    dialog = GTK_DIALOG (et_application_window_get_scan_dialog (ET_APPLICATION_WINDOW (MainWindow)));
+
     /* Scanner Window */
-    if (ScannerWindow)
+    if (dialog)
     {
-        gtk_dialog_set_response_sensitive (GTK_DIALOG (ScannerWindow),
-                                           GTK_RESPONSE_APPLY, FALSE);
+        gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_APPLY, FALSE);
     }
 
     /* "File" menu commands */
@@ -2650,9 +2545,13 @@ Init_Load_Default_Dir (void)
     ET_Core_Free();
     ET_Core_Initialize();
 
-    // Open the scanner window
+    /* FIXME: Open the scanner window. */
+    /*
     if (OPEN_SCANNER_WINDOW_ON_STARTUP)
-        Open_ScannerWindow(SCANNER_TYPE); // Open the last selected scanner
+    {
+        et_application_window_show_scan_dialog (ET_APPLICATION_WINDOW (MainWindow));
+    }
+    */
 
     if (INIT_DIRECTORY)
     {
diff --git a/src/easytag.h b/src/easytag.h
index 79bbd81..7322871 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -101,6 +101,7 @@ gboolean ReadingDirectory;
 /**************
  * Prototypes *
  **************/
+void Disable_Command_Buttons (void);
 void et_on_action_select_all (void);
 void et_on_action_unselect_all (void);
 void Action_Invert_Files_Selection      (void);
@@ -111,7 +112,6 @@ void Action_Select_Last_File            (void);
 void Action_Select_Nth_File_By_Position (gulong num_item);
 void Action_Select_Nth_File_By_Etfile   (ET_File *ETFile);
 
-void Action_Scan_Selected_Files         (void);
 void Action_Remove_Selected_Tags        (void);
 gint Action_Undo_Selected_Files         (void);
 gint Action_Redo_Selected_File          (void);
diff --git a/src/load_files_dialog.c b/src/load_files_dialog.c
index 4716d2a..79145dd 100644
--- a/src/load_files_dialog.c
+++ b/src/load_files_dialog.c
@@ -23,6 +23,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
 
+#include "application_window.h"
 #include "bar.h"
 #include "browser.h"
 #include "charset.h"
@@ -136,9 +137,18 @@ Load_Filename_Set_Filenames (EtLoadFilesDialog *self)
 
             g_free(filename_new_utf8);
 
-            // Then run current scanner if asked...
-            if (ScannerWindow && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->load_file_run_scanner)) )
-                Scan_Select_Mode_And_Run_Scanner(ETFile);
+            /* Then run current scanner if requested. */
+            if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->load_file_run_scanner)))
+            {
+                EtScanDialog *dialog;
+
+                dialog = ET_SCAN_DIALOG (et_application_window_get_scan_dialog (ET_APPLICATION_WINDOW 
(MainWindow)));
+
+                if (dialog)
+                {
+                    Scan_Select_Mode_And_Run_Scanner (dialog, ETFile);
+                }
+            }
         }
         g_free(list_text);
     }
diff --git a/src/misc.c b/src/misc.c
index ba5beb8..5c7ab71 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -34,8 +34,6 @@
 #include "setting.h"
 #include "bar.h"
 #include "preferences_dialog.h"
-#include "scan.h"
-#include "scan_dialog.h"
 #include "genres.h"
 #include "log.h"
 #include "charset.h"
diff --git a/src/playlist_dialog.c b/src/playlist_dialog.c
index 7949b0e..137f718 100644
--- a/src/playlist_dialog.c
+++ b/src/playlist_dialog.c
@@ -446,7 +446,7 @@ write_button_clicked (EtPlaylistDialog *self)
         }
         if (RFS_CONVERT_SPACE_INTO_UNDERSCORE)
         {
-            Scan_Convert_Space_Into_Underscore(playlist_basename_utf8);
+            Scan_Convert_Space_Into_Underscore (playlist_basename_utf8);
         }
         if (RFS_REMOVE_SPACES)
                                 {
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index d9ddc56..fdc2181 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -35,7 +35,7 @@
 #include "setting.h"
 #include "bar.h"
 #include "misc.h"
-#include "scan.h"
+#include "scan_dialog.h"
 #include "easytag.h"
 #include "browser.h"
 #include "cddb_dialog.h"
diff --git a/src/scan.h b/src/scan.h
index 8c54686..e8a8e05 100644
--- a/src/scan.h
+++ b/src/scan.h
@@ -21,6 +21,8 @@
 
 #include <glib.h>
 
+G_BEGIN_DECLS
+
 void Scan_Convert_Underscore_Into_Space (gchar *string);
 void Scan_Convert_P20_Into_Space (gchar *string);
 void Scan_Convert_Space_Into_Underscore (gchar *string);
@@ -32,4 +34,6 @@ gchar* Scan_Process_Fields_All_Uppercase (const gchar *string);
 gchar* Scan_Process_Fields_All_Downcase (const gchar *string);
 gchar* Scan_Process_Fields_Letter_Uppercase (const gchar *string);
 
+G_END_DECLS
+
 #endif /* !ET_SCAN_H_ */
diff --git a/src/scan_dialog.c b/src/scan_dialog.c
index da21231..2c52844 100644
--- a/src/scan_dialog.c
+++ b/src/scan_dialog.c
@@ -1,4 +1,3 @@
-/* scan.c - 2000/06/16 */
 /*
  *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
  *  Copyright (C) 2000-2003  Jerome Couderc <easytag gmail com>
@@ -18,7 +17,9 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-#include <config.h>
+#include "config.h"
+
+#include "scan_dialog.h"
 
 #include <gtk/gtk.h>
 #include <string.h>
@@ -27,12 +28,11 @@
 #include <config.h>
 #include <glib/gi18n.h>
 
-#include "scan_dialog.h"
-
+#include "application_window.h"
 #include "gtk2_compat.h"
-#include "scan.h"
 #include "easytag.h"
 #include "preferences_dialog.h"
+#include "scan.h"
 #include "setting.h"
 #include "id3_tag.h"
 #include "bar.h"
@@ -43,71 +43,65 @@
 #include "crc32.h"
 #include "charset.h"
 
+/* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
+G_DEFINE_TYPE (EtScanDialog, et_scan_dialog, GTK_TYPE_DIALOG)
+
+#define et_scan_dialog_get_instance_private(dialog) (dialog->priv)
 
-#define step(a,b) (b-a)+1
-
-
-/****************
- * Declarations *
- ****************/
-static GtkWidget *ScanTagMaskCombo = NULL;
-static GtkWidget *RenameFileMaskCombo = NULL;
-static GtkWidget *ScannerOptionCombo = NULL;
-static GtkWidget *RenameFilePrefixPathButton = NULL;
-
-static GtkWidget *ScanTagFrame;
-static GtkWidget *RenameFileFrame;
-static GtkWidget *ProcessFieldsFrame;
-static GtkWidget *FillTagPreviewLabel = NULL;
-static GtkWidget *RenameFilePreviewLabel = NULL;
-
-static GtkListStore *RenameFileListModel;
-static GtkListStore *ScanTagListModel;
-
-static GtkWidget *ProcessFileNameField;
-static GtkWidget *ProcessTitleField;
-static GtkWidget *ProcessArtistField;
-static GtkWidget *ProcessAlbumArtistField;
-static GtkWidget *ProcessAlbumField;
-static GtkWidget *ProcessGenreField;
-static GtkWidget *ProcessCommentField;
-static GtkWidget *ProcessComposerField;
-static GtkWidget *ProcessOrigArtistField;
-static GtkWidget *ProcessCopyrightField;
-static GtkWidget *ProcessURLField;
-static GtkWidget *ProcessEncodedByField;
-static GtkWidget *ProcessFieldsConvertIntoSpace = NULL;
-static GtkWidget *ProcessFieldsConvertSpace = NULL;
-static GtkWidget *ProcessFieldsConvert = NULL;
-static GtkWidget *ProcessFieldsConvertLabelTo;
-static GtkWidget *ProcessFieldsConvertTo = NULL;
-static GtkWidget *ProcessFieldsConvertFrom = NULL;
-static GtkWidget *ProcessFieldsAllUppercase = NULL;
-static GtkWidget *ProcessFieldsAllDowncase = NULL;
-static GtkWidget *ProcessFieldsFirstLetterUppercase = NULL;
-static GtkWidget *ProcessFieldsFirstLettersUppercase = NULL;
-static GtkWidget *ProcessFieldsDetectRomanNumerals = NULL;
-static GtkWidget *ProcessFieldsRemoveSpace = NULL;
-static GtkWidget *ProcessFieldsInsertSpace = NULL;
-static GtkWidget *ProcessFieldsOnlyOneSpace = NULL;
-
-static GtkWidget *LegendFrame = NULL;
-static GtkWidget *LegendButton = NULL;
-
-static GtkWidget *MaskEditorButton = NULL;
-static GtkWidget *MaskEditorFrame  = NULL;
-static GtkWidget *MaskEditorVBox;
-static GtkWidget *MaskEditorHBox;
-static GtkWidget *MaskEditorScrollWindow;
-static GtkWidget *MaskEditorList;
-static GtkWidget *MaskEditorEntry;
-static GtkWidget *MaskEditorNewButton;
-static GtkWidget *MaskEditorCopyButton;
-static GtkWidget *MaskEditorAddButton;
-static GtkWidget *MaskEditorRemoveButton;
-static GtkWidget *MaskEditorUpButton;
-static GtkWidget *MaskEditorDownButton;
-static GtkWidget *MaskEditorSaveButton;
+struct _EtScanDialogPrivate
+{
+    GtkListStore *rename_masks_model;
+    GtkListStore *scan_tag_masks_model;
+
+    GtkWidget *mask_editor_entry;
+    GtkWidget *mask_editor_view;
+
+    GtkWidget *type_combo;
+    GtkWidget *scan_tag_mask_combo;
+    GtkWidget *rename_file_mask_combo;
+
+    GtkWidget *scan_tag_frame;
+    GtkWidget *rename_file_frame;
+    GtkWidget *process_fields_frame;
+    GtkWidget *legend_frame;
+    GtkWidget *mask_editor_frame;
+
+    GtkWidget *legend_toggle;
+    GtkWidget *mask_editor_toggle;
+    GtkWidget *process_filename_toggle;
+    GtkWidget *process_title_toggle;
+    GtkWidget *process_artist_toggle;
+    GtkWidget *process_album_artist_toggle;
+    GtkWidget *process_album_toggle;
+    GtkWidget *process_genre_toggle;
+    GtkWidget *process_comment_toggle;
+    GtkWidget *process_composer_toggle;
+    GtkWidget *process_original_artist_toggle;
+    GtkWidget *process_copyright_toggle;
+    GtkWidget *process_url_toggle;
+    GtkWidget *process_encoded_by_toggle;
+
+    GtkWidget *process_convert_to_space_toggle;
+    GtkWidget *process_convert_to_underscores_toggle;
+    GtkWidget *process_convert_toggle;
+    GtkWidget *process_convert_label;
+
+    GtkWidget *process_all_uppercase_toggle;
+    GtkWidget *process_all_lowercase_toggle;
+    GtkWidget *process_first_uppercase_toggle;
+    GtkWidget *process_first_style_uppercase_toggle;
+    GtkWidget *process_roman_numerals_check;
+
+    GtkWidget *process_remove_space_toggle;
+    GtkWidget *process_insert_space_toggle;
+    GtkWidget *process_insert_one_space_toggle;
+
+    GtkWidget *process_convert_to_entry;
+    GtkWidget *process_convert_from_entry;
+
+    GtkWidget *fill_tag_preview_label;
+    GtkWidget *rename_file_preview_label;
+};
 
 static const guint BOX_SPACING = 6;
 
@@ -222,52 +216,16 @@ struct _Scan_Mask_Item
 /**************
  * Prototypes *
  **************/
-static void Scan_Tag_With_Mask (ET_File *ETFile);
-static void ScannerWindow_Quit (void);
-static void Scan_Toggle_Legend_Button (void);
-static void Scan_Toggle_Mask_Editor_Button (void);
 static void Scan_Option_Button (void);
 static void entry_check_scan_tag_mask (GtkEntry *entry, gpointer user_data);
 
 static GList *Scan_Generate_New_Tag_From_Mask (ET_File *ETFile, gchar *mask);
-static void Scan_Rename_File_Prefix_Path (void);
 static void Scan_Free_File_Rename_List (GList *list);
 static void Scan_Free_File_Fill_Tag_List (GList *list);
 
 static gchar **Scan_Return_File_Tag_Field_From_Mask_Code (File_Tag *FileTag,
                                                           gchar code);
-static void Scan_Process_Fields_Functions (gchar **string);
-
-static gint Scan_Word_Is_Roman_Numeral (const gchar *text);
-
-static void Process_Fields_Convert_Check_Button_Toggled (GtkWidget *object);
-static void Process_Fields_First_Letters_Check_Button_Toggled (GtkWidget *object);
-static void Select_Fields_Invert_Selection (void);
-static void Select_Fields_Select_Unselect_All (void);
-static void Select_Fields_Set_Sensitive (void);
-
-static void Mask_Editor_List_Row_Selected (GtkTreeSelection* selection,
-                                           gpointer data);
-static void Mask_Editor_List_Set_Row_Visible (GtkTreeModel *treeModel,
-                                              GtkTreeIter *rowIter);
-static void Mask_Editor_List_New (void);
-static void Mask_Editor_List_Duplicate (void);
-static void Mask_Editor_List_Add (void);
-static void Mask_Editor_List_Remove (void);
-static void Mask_Editor_List_Move_Up (void);
-static void Mask_Editor_List_Move_Down (void);
-static void Mask_Editor_List_Save_Button (void);
-static void Mask_Editor_Entry_Changed (void);
-static gboolean Mask_Editor_List_Key_Press (GtkWidget *widget,
-                                            GdkEvent *event);
-
-static void Mask_Editor_Clean_Up_Masks_List (void);
-
-static void Scanner_Option_Menu_Activate_Item (GtkWidget *widget, gpointer data);
-
-static void Scan_Convert_Character (gchar **string);
 static GList *Scan_Generate_New_Tag_From_Mask (ET_File *ETFile, gchar *mask);
-static void Scan_Set_Scanner_Window_Init_Position (void);
 
 static void et_scan_on_response (GtkDialog *dialog, gint response_id,
                                  gpointer user_data);
@@ -277,20 +235,14 @@ static void et_scan_on_response (GtkDialog *dialog, gint response_id,
  * Functions *
  *************/
 
-void Init_ScannerWindow (void)
-{
-    ScannerWindow     = NULL;
-    ScannerOptionCombo= NULL;
-}
-
-
 /*
  * Uses the filename and path to fill tag information
  * Note: mask and source are read from the right to the left
  */
 static void
-Scan_Tag_With_Mask (ET_File *ETFile)
+Scan_Tag_With_Mask (EtScanDialog *self, ET_File *ETFile)
 {
+    EtScanDialogPrivate *priv;
     GList *fill_tag_list = NULL;
     GList *l;
     gchar **dest = NULL;
@@ -298,10 +250,11 @@ Scan_Tag_With_Mask (ET_File *ETFile)
     gchar *filename_utf8;
     File_Tag *FileTag;
 
-    g_return_if_fail (ScannerWindow != NULL && ScanTagMaskCombo != NULL);
     g_return_if_fail (ETFile != NULL);
 
-    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo)))));
+    priv = et_scan_dialog_get_instance_private (self);
+
+    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo)))));
     if (!mask) return;
 
     // Create a new File_Tag item
@@ -562,19 +515,22 @@ Scan_Generate_New_Tag_From_Mask (ET_File *ETFile, gchar *mask)
     return fill_tag_list;
 }
 
-void Scan_Fill_Tag_Generate_Preview (void)
+static void
+Scan_Fill_Tag_Generate_Preview (EtScanDialog *self)
 {
+    EtScanDialogPrivate *priv;
     gchar *mask = NULL;
     gchar *preview_text = NULL;
     GList *fill_tag_list = NULL;
     GList *l;
 
+    priv = et_scan_dialog_get_instance_private (self);
+
     if (!ETCore->ETFileDisplayedList
-    ||  !ScannerWindow || !RenameFileMaskCombo || !FillTagPreviewLabel
-    ||  gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) != SCANNER_FILL_TAG)
+        || gtk_combo_box_get_active (GTK_COMBO_BOX (priv->type_combo)) != ET_SCAN_TYPE_FILL_TAG)
         return;
 
-    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo)))));
+    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo)))));
     if (!mask)
         return;
 
@@ -600,25 +556,80 @@ void Scan_Fill_Tag_Generate_Preview (void)
 
     Scan_Free_File_Fill_Tag_List(fill_tag_list);
 
-    if (GTK_IS_LABEL(FillTagPreviewLabel))
+    if (GTK_IS_LABEL(priv->fill_tag_preview_label))
+    {
+        if (preview_text)
+        {
+            //gtk_label_set_text(GTK_LABEL(priv->fill_tag_preview_label),preview_text);
+            gtk_label_set_markup(GTK_LABEL(priv->fill_tag_preview_label),preview_text);
+        } else
+        {
+            gtk_label_set_text(GTK_LABEL(priv->fill_tag_preview_label),"");
+        }
+
+        /* Force the window to be redrawn. */
+        gtk_widget_queue_resize (GTK_WIDGET (self));
+    }
+
+    g_free(mask);
+    g_free(preview_text);
+}
+
+static void
+Scan_Rename_File_Generate_Preview (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    gchar *preview_text = NULL;
+    gchar *mask = NULL;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    if (!ETCore->ETFileDisplayed
+    || !priv->rename_file_mask_combo || !priv->rename_file_preview_label)
+        return;
+
+    if (gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo)) != ET_SCAN_TYPE_RENAME_FILE)
+        return;
+
+    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo)))));
+    if (!mask)
+        return;
+
+    preview_text = Scan_Generate_New_Filename_From_Mask(ETCore->ETFileDisplayed,mask,FALSE);
+
+    if (GTK_IS_LABEL(priv->rename_file_preview_label))
     {
         if (preview_text)
         {
-            //gtk_label_set_text(GTK_LABEL(FillTagPreviewLabel),preview_text);
-            gtk_label_set_markup(GTK_LABEL(FillTagPreviewLabel),preview_text);
+            //gtk_label_set_text(GTK_LABEL(priv->rename_file_preview_label),preview_text);
+            gchar *tmp_string = g_markup_printf_escaped("%s",preview_text); // To avoid problem with strings 
containing characters like '&'
+            gchar *str = g_strdup_printf("<i>%s</i>",tmp_string);
+            gtk_label_set_markup(GTK_LABEL(priv->rename_file_preview_label),str);
+            g_free(tmp_string);
+            g_free(str);
         } else
         {
-            gtk_label_set_text(GTK_LABEL(FillTagPreviewLabel),"");
+            gtk_label_set_text(GTK_LABEL(priv->rename_file_preview_label),"");
         }
 
-        // Force the window to be redrawed
-        gtk_widget_queue_resize(ScannerWindow);
+        /* Force the window to be redrawn. */
+        gtk_widget_queue_resize (GTK_WIDGET (self));
     }
 
     g_free(mask);
     g_free(preview_text);
 }
 
+
+void
+et_scan_dialog_update_previews (EtScanDialog *self)
+{
+    g_return_if_fail (ET_SCAN_DIALOG (self));
+
+    Scan_Fill_Tag_Generate_Preview (self);
+    Scan_Rename_File_Generate_Preview (self);
+}
+
 static void
 Scan_Free_File_Fill_Tag_List (GList *list)
 {
@@ -649,18 +660,20 @@ Scan_Free_File_Fill_Tag_List (GList *list)
  * Note1: a mask code may be used severals times...
  */
 static void
-Scan_Rename_File_With_Mask (ET_File *ETFile)
+Scan_Rename_File_With_Mask (EtScanDialog *self, ET_File *ETFile)
 {
+    EtScanDialogPrivate *priv;
     gchar *filename_generated_utf8 = NULL;
     gchar *filename_generated = NULL;
     gchar *filename_new_utf8 = NULL;
     gchar *mask = NULL;
     File_Name *FileName;
 
-    g_return_if_fail (ScannerWindow != NULL || RenameFileMaskCombo != NULL ||
-                      ETFile != NULL);
+    g_return_if_fail (ETFile != NULL);
+
+    priv = et_scan_dialog_get_instance_private (self);
 
-    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo)))));
+    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo)))));
     if (!mask) return;
 
     // Note : if the first character is '/', we have a path with the filename,
@@ -681,7 +694,7 @@ Scan_Rename_File_With_Mask (ET_File *ETFile)
     if (!filename_generated)
     {
         GtkWidget *msgdialog;
-        msgdialog = gtk_message_dialog_new(GTK_WINDOW(ScannerWindow),
+        msgdialog = gtk_message_dialog_new (GTK_WINDOW (self),
                              GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                              GTK_MESSAGE_ERROR,
                              GTK_BUTTONS_CLOSE,
@@ -937,48 +950,6 @@ gchar *Scan_Generate_New_Filename_From_Mask (ET_File *ETFile, gchar *mask, gbool
     return filename_new_utf8; // in UTF-8!
 }
 
-void Scan_Rename_File_Generate_Preview (void)
-{
-    gchar *preview_text = NULL;
-    gchar *mask = NULL;
-
-    if (!ETCore->ETFileDisplayed
-    ||  !ScannerWindow || !RenameFileMaskCombo || !RenameFilePreviewLabel)
-        return;
-
-    if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) != SCANNER_RENAME_FILE)
-        return;
-
-    mask = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo)))));
-    if (!mask)
-        return;
-
-    preview_text = Scan_Generate_New_Filename_From_Mask(ETCore->ETFileDisplayed,mask,FALSE);
-
-    if (GTK_IS_LABEL(RenameFilePreviewLabel))
-    {
-        if (preview_text)
-        {
-            //gtk_label_set_text(GTK_LABEL(RenameFilePreviewLabel),preview_text);
-            gchar *tmp_string = g_markup_printf_escaped("%s",preview_text); // To avoid problem with strings 
containing characters like '&'
-            gchar *str = g_strdup_printf("<i>%s</i>",tmp_string);
-            gtk_label_set_markup(GTK_LABEL(RenameFilePreviewLabel),str);
-            g_free(tmp_string);
-            g_free(str);
-        } else
-        {
-            gtk_label_set_text(GTK_LABEL(RenameFilePreviewLabel),"");
-        }
-
-        // Force the window to be redrawed
-        gtk_widget_queue_resize(ScannerWindow);
-    }
-
-    g_free(mask);
-    g_free(preview_text);
-}
-
-
 static void
 Scan_Free_File_Rename_List (GList *list)
 {
@@ -1000,8 +971,9 @@ Scan_Free_File_Rename_List (GList *list)
  * Adds the current path of the file to the mask on the "Rename File Scanner" entry
  */
 static void
-Scan_Rename_File_Prefix_Path (void)
+Scan_Rename_File_Prefix_Path (EtScanDialog *self)
 {
+    EtScanDialogPrivate *priv;
     gint pos;
     gchar *path_tmp;
     const gchar *combo_text = NULL;
@@ -1016,12 +988,13 @@ Scan_Rename_File_Prefix_Path (void)
     }
 
     filename_utf8_cur = ((File_Name *)ETFile->FileNameCur->data)->value_utf8;
+    priv = et_scan_dialog_get_instance_private (self);
 
     // The path to prefix
     path_utf8_cur = g_path_get_dirname(filename_utf8_cur);
 
     // The current text in the combobox
-    combo_text = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo))));
+    combo_text = gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo))));
     /*if (!g_utf8_validate(combo_text, -1, NULL))
     {
         combo_tmp = convert_to_utf8(combo_text);
@@ -1043,7 +1016,7 @@ Scan_Rename_File_Prefix_Path (void)
             path_tmp = g_strconcat(path_utf8_cur,G_DIR_SEPARATOR_S,NULL);
         }
        pos = 0;
-        gtk_editable_insert_text(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo))),path_tmp, -1, 
&pos);
+        
gtk_editable_insert_text(GTK_EDITABLE(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo))),path_tmp, -1, 
&pos);
         g_free(path_tmp);
     }
 
@@ -1073,7 +1046,7 @@ void Scan_Rename_Directory_Generate_Preview (void)
     {
         if (preview_text)
         {
-            //gtk_label_set_text(GTK_LABEL(RenameFilePreviewLabel),preview_text);
+            //gtk_label_set_text(GTK_LABEL(priv->rename_file_preview_label),preview_text);
             gchar *tmp_string = g_markup_printf_escaped("%s",preview_text); // To avoid problem with strings 
containing characters like '&'
             gchar *str = g_strdup_printf("<i>%s</i>",tmp_string);
             gtk_label_set_markup(GTK_LABEL(RenameDirectoryPreviewLabel),str);
@@ -1098,14 +1071,132 @@ gchar *Scan_Generate_New_Directory_Name_From_Mask (ET_File *ETFile, gchar *mask,
 }
 
 
+/*
+ * Replace something with something else ;)
+ * Here use Regular Expression, to search and replace.
+ */
+static void
+Scan_Convert_Character (EtScanDialog *self, gchar **string)
+{
+    EtScanDialogPrivate *priv;
+    gchar *from;
+    gchar *to;
+    GRegex *regex;
+    GError *regex_error = NULL;
+    gchar *new_string;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    from = gtk_editable_get_chars (GTK_EDITABLE (priv->process_convert_from_entry), 0,
+                                 -1);
+    to = gtk_editable_get_chars (GTK_EDITABLE (priv->process_convert_to_entry), 0, -1);
+
+    regex = g_regex_new (from, 0, 0, &regex_error);
+    if (regex_error != NULL)
+    {
+        goto handle_error;
+    }
+
+    new_string = g_regex_replace (regex, *string, -1, 0, to, 0, &regex_error);
+    if (regex_error != NULL)
+    {
+        g_free (new_string);
+        g_regex_unref (regex);
+        goto handle_error;
+    }
+
+    /* Success. */
+    g_regex_unref (regex);
+    g_free (*string);
+    *string = new_string;
+
+out:
+    g_free (from);
+    g_free (to);
+    return;
+
+handle_error:
+    Log_Print (LOG_ERROR, _("Error while processing fields: %s"),
+               regex_error->message);
+
+    g_error_free (regex_error);
+
+    goto out;
+}
+
+static void
+Scan_Process_Fields_Functions (EtScanDialog *self, gchar **string)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_space_toggle)))
+    {
+        Scan_Convert_Underscore_Into_Space(*string);
+        Scan_Convert_P20_Into_Space(*string);
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_underscores_toggle)))
+        Scan_Convert_Space_Into_Underscore (*string);
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_insert_space_toggle)))
+    {
+        gchar *res;
+        res = Scan_Process_Fields_Insert_Space (*string);
+        g_free (*string);
+        *string = res;
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_insert_one_space_toggle)))
+        Scan_Process_Fields_Keep_One_Space(*string);
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_toggle)))
+        Scan_Convert_Character (self, string);
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_all_uppercase_toggle)))
+    {
+        gchar *res;
+        res = Scan_Process_Fields_All_Uppercase (*string);
+        g_free (*string);
+        *string = res;
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_all_lowercase_toggle)))
+    {
+        gchar *res;
+        res = Scan_Process_Fields_All_Downcase (*string);
+        g_free (*string);
+        *string = res;
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_first_uppercase_toggle)))
+    {
+        gchar *res;
+        res = Scan_Process_Fields_Letter_Uppercase (*string);
+        g_free (*string);
+        *string = res;
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_first_style_uppercase_toggle)))
+    {
+        Scan_Process_Fields_First_Letters_Uppercase (self, string);
+    }
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_remove_space_toggle)))
+        Scan_Process_Fields_Remove_Space(*string);
+
+}
+
 
 /*****************************
  * Scanner To Process Fields *
  *****************************/
 /* See also functions : Convert_P20_And_Undescore_Into_Spaces, ... in easytag.c */
 static void
-Scan_Process_Fields (ET_File *ETFile)
+Scan_Process_Fields (EtScanDialog *self, ET_File *ETFile)
 {
+    EtScanDialogPrivate *priv;
     File_Name *FileName = NULL;
     File_Tag  *FileTag  = NULL;
     File_Name *st_filename;
@@ -1113,7 +1204,9 @@ Scan_Process_Fields (ET_File *ETFile)
     gchar     *filename_utf8;
     gchar     *string;
 
-    g_return_if_fail (ScannerWindow != NULL || ETFile != NULL);
+    g_return_if_fail (ETFile != NULL);
+
+    priv = et_scan_dialog_get_instance_private (self);
 
     st_filename = (File_Name *)ETFile->FileNameNew->data;
     st_filetag  = (File_Tag  *)ETFile->FileTag->data;
@@ -1121,7 +1214,7 @@ Scan_Process_Fields (ET_File *ETFile)
     /* Process the filename */
     if (st_filename != NULL)
     {
-        if (st_filename->value_utf8 && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFileNameField)))
+        if (st_filename->value_utf8 && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle)))
         {
             gchar *string_utf8;
             gchar *pos;
@@ -1135,7 +1228,7 @@ Scan_Process_Fields (ET_File *ETFile)
             // Remove the extension to set it to lower case (to avoid problem with undo)
             if ((pos=strrchr(string,'.'))!=NULL) *pos = 0;
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             string_utf8 = ET_File_Name_Generate(ETFile,string);
             ET_Set_Filename_File_Name_Item(FileName,string_utf8,NULL);
@@ -1148,7 +1241,7 @@ Scan_Process_Fields (ET_File *ETFile)
     if (st_filetag != NULL)
     {
         // Title field
-        if (st_filetag->title && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessTitleField)))
+        if (st_filetag->title && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle)))
         {
             if (!FileTag)
             {
@@ -1158,7 +1251,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->title);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->title,string);
 
@@ -1166,7 +1259,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // Artist field
-        if (st_filetag->artist && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessArtistField)))
+        if (st_filetag->artist && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle)))
         {
             if (!FileTag)
             {
@@ -1176,7 +1269,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->artist);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->artist,string);
 
@@ -1184,7 +1277,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
                // Album Artist field
-        if (st_filetag->album_artist && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField)))
+        if (st_filetag->album_artist && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle)))
         {
             if (!FileTag)
             {
@@ -1194,14 +1287,14 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->album_artist);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->album_artist,string);
 
             g_free(string);
         }
         // Album field
-        if (st_filetag->album && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumField)))
+        if (st_filetag->album && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle)))
         {
             if (!FileTag)
             {
@@ -1211,7 +1304,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->album);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->album,string);
 
@@ -1219,7 +1312,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // Genre field
-        if (st_filetag->genre && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessGenreField)))
+        if (st_filetag->genre && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle)))
         {
             if (!FileTag)
             {
@@ -1229,7 +1322,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->genre);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->genre,string);
 
@@ -1237,7 +1330,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // Comment field
-        if (st_filetag->comment && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCommentField)))
+        if (st_filetag->comment && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle)))
         {
             if (!FileTag)
             {
@@ -1247,7 +1340,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->comment);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->comment,string);
 
@@ -1255,7 +1348,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // Composer field
-        if (st_filetag->composer && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessComposerField)))
+        if (st_filetag->composer && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle)))
         {
             if (!FileTag)
             {
@@ -1265,7 +1358,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->composer);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->composer,string);
 
@@ -1273,7 +1366,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // Original artist field
-        if (st_filetag->orig_artist && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField)))
+        if (st_filetag->orig_artist && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle)))
         {
             if (!FileTag)
             {
@@ -1283,7 +1376,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->orig_artist);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->orig_artist,string);
 
@@ -1291,7 +1384,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // Copyright field
-        if (st_filetag->copyright && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField)))
+        if (st_filetag->copyright && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle)))
         {
             if (!FileTag)
             {
@@ -1301,7 +1394,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->copyright);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->copyright,string);
 
@@ -1309,7 +1402,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // URL field
-        if (st_filetag->url && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessURLField)))
+        if (st_filetag->url && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle)))
         {
             if (!FileTag)
             {
@@ -1319,7 +1412,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->url);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->url,string);
 
@@ -1327,7 +1420,7 @@ Scan_Process_Fields (ET_File *ETFile)
         }
 
         // 'Encoded by' field
-        if (st_filetag->encoded_by && gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField)))
+        if (st_filetag->encoded_by && 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle)))
         {
             if (!FileTag)
             {
@@ -1337,7 +1430,7 @@ Scan_Process_Fields (ET_File *ETFile)
 
             string = g_strdup(st_filetag->encoded_by);
 
-            Scan_Process_Fields_Functions(&string);
+            Scan_Process_Fields_Functions (self, &string);
 
             ET_Set_Field_File_Tag_Item(&FileTag->encoded_by,string);
 
@@ -1355,65 +1448,79 @@ Scan_Process_Fields (ET_File *ETFile)
 
 }
 
-
-static void
-Scan_Process_Fields_Functions (gchar **string)
+static gint
+Scan_Word_Is_Roman_Numeral (EtScanDialog *self, const gchar *text)
 {
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvertIntoSpace)))
-    {
-        Scan_Convert_Underscore_Into_Space(*string);
-        Scan_Convert_P20_Into_Space(*string);
-    }
+    EtScanDialogPrivate *priv;
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvertSpace)))
-        Scan_Convert_Space_Into_Underscore (*string);
+    /* No need for caseless strchr. */
+    static const gchar romans[] = "MmDdCcLlXxVvIi";
+
+    gsize next_allowed = 0;
+    gsize prev = 0;
+    gsize count = 0;
+    const gchar *i;
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsInsertSpace)))
+    priv = et_scan_dialog_get_instance_private (self);
+
+    if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->process_roman_numerals_check)))
     {
-        gchar *res;
-        res = Scan_Process_Fields_Insert_Space (*string);
-        g_free (*string);
-        *string = res;
+        return 0;
     }
+    
+    for (i = text; *i; i++)
+    {
+        const char *s = strchr (romans, *i);
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsOnlyOneSpace)))
-        Scan_Process_Fields_Keep_One_Space(*string);
+        if (s)
+        {
+            gsize c = (s - romans) / 2;
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvert)))
-        Scan_Convert_Character(string);
+            if (c < next_allowed)
+            {
+                return 0;
+            }
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsAllUppercase)))
-    {
-        gchar *res;
-        res = Scan_Process_Fields_All_Uppercase (*string);
-        g_free (*string);
-        *string = res;
-    }
+            if (c < prev)
+            {
+                /* After subtraction, no more subtracted chars allowed. */
+                next_allowed = prev + 1;
+            }
+            else if (c == prev)
+            {
+                /* Allow indefinite repetition for m; three for c, x and i; and
+                 * none for d, l and v. */
+                if ((c && ++count > 3) || (c & 1))
+                {
+                    return 0;
+                }
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsAllDowncase)))
-    {
-        gchar *res;
-        res = Scan_Process_Fields_All_Downcase (*string);
-        g_free (*string);
-        *string = res;
-    }
+                /* No more subtraction. */
+                next_allowed = c;
+            }
+            else if (c && !(c & 1))
+            {
+                /* For first occurrence of c, x and i, allow "subtraction" from
+                 * 10 and 5 times self, reset counting. */
+                next_allowed = c - 2;
+                count = 1;
+            }
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsFirstLetterUppercase)))
-    {
-        gchar *res;
-        res = Scan_Process_Fields_Letter_Uppercase (*string);
-        g_free (*string);
-        *string = res;
-    }
+            prev = c;
+        }
+        else
+        {
+            if (g_unichar_isalnum (g_utf8_get_char (i)))
+            {
+                return 0;
+            }
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsFirstLettersUppercase)))
-    {
-        Scan_Process_Fields_First_Letters_Uppercase (string);
+            break;
+        }
     }
 
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsRemoveSpace)))
-        Scan_Process_Fields_Remove_Space(*string);
-
+    /* Return length of found Roman numeral. */
+    return i - text;
 }
 
 /*
@@ -1421,7 +1528,7 @@ Scan_Process_Fields_Functions (gchar **string)
  * No needed to reallocate
  */
 void
-Scan_Process_Fields_First_Letters_Uppercase (gchar **str)
+Scan_Process_Fields_First_Letters_Uppercase (EtScanDialog *self, gchar **str)
 {
 /**** DANIEL TEST *****
     gchar *iter;
@@ -1492,13 +1599,13 @@ Scan_Process_Fields_First_Letters_Uppercase (gchar **str)
         Log_Print(LOG_ERROR,"Scan_Process_Fields_First_Letters_Uppercase: Not a valid utf8! quiting");
         return;
     }
-    // Removes trailing whitespace
+    /* Removes trailing whitespace. */
     string = g_strchomp(string);
 
     temp = string;
 
-    // If the word is a roman numeral, capitalize all of it
-    if ((len = Scan_Word_Is_Roman_Numeral(temp)))
+    /* If the word is a roman numeral, capitalize all of it. */
+    if ((len = Scan_Word_Is_Roman_Numeral (self, temp)))
     {
         gchar *tmp = g_utf8_strup (temp, len);
         strncpy (string, tmp, len);
@@ -1538,7 +1645,7 @@ Scan_Process_Fields_First_Letters_Uppercase (gchar **str)
         word = word+1;
 
         // If the word is a roman numeral, capitalize all of it
-        if ((len = Scan_Word_Is_Roman_Numeral(word)))
+        if ((len = Scan_Word_Is_Roman_Numeral (self, word)))
         {
             gchar *tmp = g_utf8_strup (word, len);
             strncpy (word, tmp, len);
@@ -1588,188 +1695,839 @@ Scan_Process_Fields_First_Letters_Uppercase (gchar **str)
 }
 
 /*
- * Replace something with something else ;)
- * Here use Regular Expression, to search and replace.
+ * Return the field of a 'File_Tag' structure corresponding to the mask code
+ */
+static gchar
+**Scan_Return_File_Tag_Field_From_Mask_Code (File_Tag *FileTag, gchar code)
+{
+    switch (code)
+    {
+        case 't':    /* Title */
+            return &FileTag->title;
+        case 'a':    /* Artist */
+            return &FileTag->artist;
+        case 'b':    /* Album */
+            return &FileTag->album;
+        case 'd':    /* Disc Number */
+            return &FileTag->disc_number;
+        case 'x': /* Total number of discs. */
+            return &FileTag->disc_total;
+        case 'y':    /* Year */
+            return &FileTag->year;
+        case 'n':    /* Track */
+            return &FileTag->track;
+        case 'l':    /* Track Total */
+            return &FileTag->track_total;
+        case 'g':    /* Genre */
+            return &FileTag->genre;
+        case 'c':    /* Comment */
+            return &FileTag->comment;
+        case 'p':    /* Composer */
+            return &FileTag->composer;
+        case 'o':    /* Orig. Artist */
+            return &FileTag->orig_artist;
+        case 'r':    /* Copyright */
+            return &FileTag->copyright;
+        case 'u':    /* URL */
+            return &FileTag->url;
+        case 'e':    /* Encoded by */
+            return &FileTag->encoded_by;
+        case 'z':    /* Album Artist */
+            return &FileTag->album_artist;
+        case 'i':    /* Ignored */
+            return NULL;
+        default:
+            Log_Print(LOG_ERROR,"Scanner: Invalid code '%%%c' found!",code);
+            return NULL;
+    }
+}
+
+
+
+/******************
+ * Scanner Window *
+ ******************/
+/*
+ * Function when you select an item of the option menu
  */
 static void
-Scan_Convert_Character (gchar **string)
+Scanner_Option_Menu_Activate_Item (EtScanDialog *self, GtkWidget *combo)
 {
-    gchar *from;
-    gchar *to;
-    GRegex *regex;
-    GError *regex_error = NULL;
-    gchar *new_string;
+    EtScanDialogPrivate *priv;
+    GtkRadioAction *radio_action;
 
-    from = gtk_editable_get_chars (GTK_EDITABLE (ProcessFieldsConvertFrom), 0,
-                                 -1);
-    to = gtk_editable_get_chars (GTK_EDITABLE (ProcessFieldsConvertTo), 0, -1);
+    priv = et_scan_dialog_get_instance_private (self);
 
-    regex = g_regex_new (from, 0, 0, &regex_error);
-    if (regex_error != NULL)
-    {
-        goto handle_error;
-    }
+    radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (UIManager,
+                                                                "/MenuBar/ViewMenu/ScannerMenu/FillTag"));
+    SCANNER_TYPE = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
+    gtk_radio_action_set_current_value (radio_action, SCANNER_TYPE);
 
-    new_string = g_regex_replace (regex, *string, -1, 0, to, 0, &regex_error);
-    if (regex_error != NULL)
+    switch (SCANNER_TYPE)
     {
-        g_free (new_string);
-        g_regex_unref (regex);
-        goto handle_error;
-    }
+        case ET_SCAN_TYPE_FILL_TAG:
+            gtk_widget_show(priv->mask_editor_toggle);
+            gtk_widget_show(priv->legend_toggle);
+            gtk_widget_show(priv->scan_tag_frame);
+            gtk_widget_hide(priv->rename_file_frame);
+            gtk_widget_hide(priv->process_fields_frame);
+            gtk_tree_view_set_model(GTK_TREE_VIEW(priv->mask_editor_view), 
GTK_TREE_MODEL(priv->scan_tag_masks_model));
+            Scan_Fill_Tag_Generate_Preview (self);
+            g_signal_emit_by_name(G_OBJECT(priv->legend_toggle),"toggled");        /* To hide or show legend 
frame */
+            g_signal_emit_by_name(G_OBJECT(priv->mask_editor_toggle),"toggled");    /* To hide or show mask 
editor frame */
+            break;
 
-    /* Success. */
-    g_regex_unref (regex);
-    g_free (*string);
-    *string = new_string;
+        case ET_SCAN_TYPE_RENAME_FILE:
+            gtk_widget_show(priv->mask_editor_toggle);
+            gtk_widget_show(priv->legend_toggle);
+            gtk_widget_hide(priv->scan_tag_frame);
+            gtk_widget_show(priv->rename_file_frame);
+            gtk_widget_hide(priv->process_fields_frame);
+            gtk_tree_view_set_model(GTK_TREE_VIEW(priv->mask_editor_view), 
GTK_TREE_MODEL(priv->rename_masks_model));
+            Scan_Rename_File_Generate_Preview (self);
+            g_signal_emit_by_name(G_OBJECT(priv->legend_toggle),"toggled");        /* To hide or show legend 
frame */
+            g_signal_emit_by_name(G_OBJECT(priv->mask_editor_toggle),"toggled");    /* To hide or show mask 
editor frame */
+            break;
 
-out:
-    g_free (from);
-    g_free (to);
-    return;
+        case ET_SCAN_TYPE_PROCESS_FIELDS:
+            gtk_widget_hide(priv->mask_editor_toggle);
+            gtk_widget_hide(priv->legend_toggle);
+            gtk_widget_hide(priv->scan_tag_frame);
+            gtk_widget_hide(priv->rename_file_frame);
+            gtk_widget_show_all(priv->process_fields_frame);
+            // Hide directly the frames to don't change state of the buttons!
+            gtk_widget_hide(priv->legend_frame);
+            gtk_widget_hide(priv->mask_editor_frame);
 
-handle_error:
-    Log_Print (LOG_ERROR, _("Error while processing fields: %s"),
-               regex_error->message);
+            gtk_tree_view_set_model(GTK_TREE_VIEW(priv->mask_editor_view), NULL);
+            break;
+        default:
+            g_assert_not_reached ();
+    }
+}
 
-    g_error_free (regex_error);
+void
+et_scan_dialog_open (EtScanDialog *self, EtScanType scanner_type)
+{
+    EtScanDialogPrivate *priv;
 
-    goto out;
+    g_return_if_fail (ET_SCAN_DIALOG (self));
+    g_return_if_fail (scanner_type >= ET_SCAN_TYPE_FILL_TAG
+                      && scanner_type <= ET_SCAN_TYPE_PROCESS_FIELDS);
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    gtk_combo_box_set_active (GTK_COMBO_BOX (priv->type_combo), scanner_type);
 }
 
-static gint
-Scan_Word_Is_Roman_Numeral (const gchar *text)
+static void
+Mask_Editor_List_Add (EtScanDialog *self)
 {
-    /* No need for caseless strchr. */
-    static const gchar romans[] = "MmDdCcLlXxVvIi";
+    EtScanDialogPrivate *priv;
+    gint i = 0;
+    GtkTreeModel *treemodel;
+    gchar *temp;
 
-    gsize next_allowed = 0;
-    gsize prev = 0;
-    gsize count = 0;
+    priv = et_scan_dialog_get_instance_private (self);
 
-    const gchar *i;
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
 
-    if (!ScannerWindow || !ProcessFieldsDetectRomanNumerals
-        || !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ProcessFieldsDetectRomanNumerals)))
+    if (gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo)) == ET_SCAN_TYPE_FILL_TAG)
     {
-        return 0;
+        while(Scan_Masks[i])
+        {
+            /*if (!g_utf8_validate(Scan_Masks[i], -1, NULL))
+                temp = convert_to_utf8(Scan_Masks[i]);
+            else
+                temp = g_strdup(Scan_Masks[i]);*/
+            temp = Try_To_Validate_Utf8_String(Scan_Masks[i]);
+
+            gtk_list_store_insert_with_values (GTK_LIST_STORE (treemodel),
+                                               NULL, G_MAXINT,
+                                               MASK_EDITOR_TEXT, temp, -1);
+            g_free(temp);
+            i++;
+        }
+    } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo)) == ET_SCAN_TYPE_RENAME_FILE)
+    {
+        while(Rename_File_Masks[i])
+        {
+            /*if (!g_utf8_validate(Rename_File_Masks[i], -1, NULL))
+                temp = convert_to_utf8(Rename_File_Masks[i]);
+            else
+                temp = g_strdup(Rename_File_Masks[i]);*/
+            temp = Try_To_Validate_Utf8_String(Rename_File_Masks[i]);
+
+            gtk_list_store_insert_with_values (GTK_LIST_STORE (treemodel),
+                                               NULL, G_MAXINT,
+                                               MASK_EDITOR_TEXT, temp, -1);
+            g_free(temp);
+            i++;
+        }
     }
+}
 
-    for (i = text; *i; i++)
+/*
+ * Clean up the currently displayed masks lists, ready for saving
+ */
+static void
+Mask_Editor_Clean_Up_Masks_List (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    gchar *text = NULL;
+    gchar *text1 = NULL;
+    GtkTreeIter currentIter;
+    GtkTreeIter itercopy;
+    GtkTreeModel *treemodel;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+
+    /* Remove blank and duplicate items */
+    if (gtk_tree_model_get_iter_first(treemodel, &currentIter))
     {
-        const char *s = strchr (romans, *i);
 
-        if (s)
+        while(TRUE)
         {
-            gsize c = (s - romans) / 2;
+            gtk_tree_model_get(treemodel, &currentIter, MASK_EDITOR_TEXT, &text, -1);
 
-            if (c < next_allowed)
+            /* Check for blank entry */
+            if (text && g_utf8_strlen(text, -1) == 0)
             {
-                return 0;
+                g_free(text);
+
+                if (!gtk_list_store_remove(GTK_LIST_STORE(treemodel), &currentIter))
+                    break; /* No following entries */
+                else
+                    continue; /* Go on to next entry, which the remove function already moved onto for us */
             }
 
-            if (c < prev)
+            /* Check for duplicate entries */
+            itercopy = currentIter;
+            if (!gtk_tree_model_iter_next(treemodel, &itercopy))
             {
-                /* After subtraction, no more subtracted chars allowed. */
-                next_allowed = prev + 1;
+                g_free(text);
+                break;
             }
-            else if (c == prev)
+
+            while(TRUE)
             {
-                /* Allow indefinite repetition for m; three for c, x and i; and
-                 * none for d, l and v. */
-                if ((c && ++count > 3) || (c & 1))
+                gtk_tree_model_get(treemodel, &itercopy, MASK_EDITOR_TEXT, &text1, -1);
+                if (text1 && g_utf8_collate(text,text1) == 0)
                 {
-                    return 0;
+                    g_free(text1);
+
+                    if (!gtk_list_store_remove(GTK_LIST_STORE(treemodel), &itercopy))
+                        break; /* No following entries */
+                    else
+                        continue; /* Go on to next entry, which the remove function already set iter to for 
us */
+
                 }
+                g_free(text1);
+                if (!gtk_tree_model_iter_next(treemodel, &itercopy))
+                    break;
+            }
 
-                /* No more subtraction. */
-                next_allowed = c;
+            g_free(text);
+
+            if (!gtk_tree_model_iter_next(treemodel, &currentIter))
+                break;
+        }
+    }
+}
+
+/*
+ * Save the currently displayed mask list in the mask editor
+ */
+static void
+Mask_Editor_List_Save_Button (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    Mask_Editor_Clean_Up_Masks_List (self);
+
+    if (gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo)) == ET_SCAN_TYPE_FILL_TAG)
+    {
+        Save_Scan_Tag_Masks_List(priv->scan_tag_masks_model, MASK_EDITOR_TEXT);
+    } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo)) == ET_SCAN_TYPE_RENAME_FILE)
+    {
+        Save_Rename_File_Masks_List(priv->rename_masks_model, MASK_EDITOR_TEXT);
+    }
+}
+
+static void
+on_hide (EtScanDialog *self)
+{
+    GtkToggleAction *toggle_action;
+
+    toggle_action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (UIManager,
+                                                                  "/ToolBar/ShowScanner"));
+
+    if (gtk_toggle_action_get_active (toggle_action))
+    {
+        gtk_toggle_action_set_active (toggle_action, FALSE);
+    }
+
+}
+
+static void
+Select_Fields_Select_Unselect_All (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    static gboolean state = TRUE;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle),   state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle),      state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle),     state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle),state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle),      state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle),      state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle),    state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle),   state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle), state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle),  state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle),        state);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle),  state);
+    state = !state;
+}
+
+static void
+Process_Fields_First_Letters_Check_Button_Toggled (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    gtk_widget_set_sensitive (GTK_WIDGET (priv->process_roman_numerals_check),
+                              gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(priv->process_first_style_uppercase_toggle)));
+}
+
+/*
+ * Set sensitive state of the processing check boxes : if no one is selected => all disabled
+ */
+static void
+Select_Fields_Set_Sensitive (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle))
+    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle)))
+    {
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_to_space_toggle),     TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_to_underscores_toggle),         TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_toggle),              TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_label),       TRUE);
+        // Activate the two entries only if the check box is activated, else keep them disabled
+        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_toggle)))
+        {
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_to_entry),        TRUE);
+            gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_from_entry),      TRUE);
+        }
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_all_uppercase_toggle),         TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_all_lowercase_toggle),          TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_first_uppercase_toggle), TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_first_style_uppercase_toggle),TRUE);
+        Process_Fields_First_Letters_Check_Button_Toggled (self);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_remove_space_toggle),          TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_insert_space_toggle),          TRUE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_insert_one_space_toggle),         TRUE);
+    }else
+    {
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_to_space_toggle),     FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_to_underscores_toggle),         FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_toggle),              FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_to_entry),            FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_label),       FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_convert_from_entry),          FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_all_uppercase_toggle),         FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_all_lowercase_toggle),          FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_first_uppercase_toggle), FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_first_style_uppercase_toggle),FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_roman_numerals_check),  FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_remove_space_toggle),          FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_insert_space_toggle),          FALSE);
+        gtk_widget_set_sensitive(GTK_WIDGET(priv->process_insert_one_space_toggle),         FALSE);
+    }
+}
+
+/*
+ * Small buttons of Process Fields scanner
+ */
+static void
+Select_Fields_Invert_Selection (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle),
+                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle)));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle),
+                                
!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle)));
+}
+
+static void
+Scan_Toggle_Legend_Button (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->legend_toggle)))
+    {
+        gtk_widget_show_all (priv->legend_frame);
+    }
+    else
+    {
+        gtk_widget_hide (priv->legend_frame);
+    }
+}
+
+static void
+Scan_Toggle_Mask_Editor_Button (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    GtkTreeModel *treemodel;
+    GtkTreeSelection *selection;
+    GtkTreeIter iter;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->mask_editor_toggle)))
+    {
+        gtk_widget_show_all(priv->mask_editor_frame);
+
+        // Select first row in list
+        treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+        if (gtk_tree_model_get_iter_first(treemodel, &iter))
+        {
+            selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+            gtk_tree_selection_unselect_all(selection);
+            gtk_tree_selection_select_iter(selection, &iter);
+        }
+
+        // Update status of the icon box cause prev instruction show it for all cases
+        g_signal_emit_by_name(G_OBJECT(priv->mask_editor_entry),"changed");
+    }else
+    {
+        gtk_widget_hide(priv->mask_editor_frame);
+    }
+}
+
+/*
+ * Update the Mask List with the new value of the entry box
+ */
+static void
+Mask_Editor_Entry_Changed (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    GtkTreeSelection *selection;
+    GtkTreePath *firstSelected;
+    GtkTreeModel *treemodel;
+    GList *selectedRows;
+    GtkTreeIter row;
+    const gchar* text;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+
+    if (!selectedRows)
+    {
+        return;
+    }
+
+    firstSelected = (GtkTreePath *)g_list_first(selectedRows)->data;
+    text = gtk_entry_get_text(GTK_ENTRY(priv->mask_editor_entry));
+
+    if (gtk_tree_model_get_iter (treemodel, &row, firstSelected))
+    {
+        gtk_list_store_set(GTK_LIST_STORE(treemodel), &row, MASK_EDITOR_TEXT, text, -1);
+    }
+
+    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
+}
+
+/*
+ * Callback from the mask edit list
+ * Previously known as Mask_Editor_List_Select_Row
+ */
+static void
+Mask_Editor_List_Row_Selected (GtkTreeSelection* selection, EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    GList *selectedRows;
+    gchar *text = NULL;
+    GtkTreePath *lastSelected;
+    GtkTreeIter lastFile;
+    GtkTreeModel *treemodel;
+    gboolean valid;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+
+    /* We must block the function, else the previous selected row will be modified */
+    g_signal_handlers_block_by_func(G_OBJECT(priv->mask_editor_entry),
+                                    G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
+
+    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+
+    /*
+     * At some point, we might get called when no rows are selected?
+     */
+    if (!selectedRows)
+    {
+        g_signal_handlers_unblock_by_func(G_OBJECT(priv->mask_editor_entry),
+                                          G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
+        return;
+    }
+
+    /* Get the text of the last selected row */
+    lastSelected = (GtkTreePath *)g_list_last(selectedRows)->data;
+
+    valid= gtk_tree_model_get_iter(treemodel, &lastFile, lastSelected);
+    if (valid)
+    {
+        gtk_tree_model_get(treemodel, &lastFile, MASK_EDITOR_TEXT, &text, -1);
+
+        if (text)
+        {
+            gtk_entry_set_text(GTK_ENTRY(priv->mask_editor_entry),text);
+            g_free(text);
+        }
+    }
+
+    g_signal_handlers_unblock_by_func(G_OBJECT(priv->mask_editor_entry),
+                                      G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
+
+    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
+}
+
+/*
+ * Remove the selected rows from the mask editor list
+ */
+static void
+Mask_Editor_List_Remove (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    GtkTreeSelection *selection;
+    GtkTreeIter iter;
+    GtkTreeModel *treemodel;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+
+    if (gtk_tree_selection_count_selected_rows(selection) == 0) {
+        Log_Print(LOG_ERROR,_("Remove: No row selected"));
+        return;
+    }
+
+    if (!gtk_tree_model_get_iter_first(treemodel, &iter))
+        return;
+
+    while (TRUE)
+    {
+        if (gtk_tree_selection_iter_is_selected(selection, &iter))
+        {
+            if (!gtk_list_store_remove(GTK_LIST_STORE(treemodel), &iter))
+            {
+                break;
             }
-            else if (c && !(c & 1))
+        } else
+        {
+            if (!gtk_tree_model_iter_next(treemodel, &iter))
             {
-                /* For first occurrence of c, x and i, allow "subtraction" from
-                 * 10 and 5 times self, reset counting. */
-                next_allowed = c - 2;
-                count = 1;
+                break;
             }
-
-            prev = c;
         }
-        else
+    }
+}
+
+/*
+ * Actions when the a key is pressed into the masks editor clist
+ */
+static gboolean
+Mask_Editor_List_Key_Press (GtkWidget *widget,
+                            GdkEvent *event,
+                            EtScanDialog *self)
+{
+    if (event && event->type == GDK_KEY_PRESS) {
+        GdkEventKey *kevent = (GdkEventKey *)event;
+
+        switch(kevent->keyval)
         {
-            if (g_unichar_isalnum (g_utf8_get_char (i)))
+            case GDK_KEY_Delete:
+                Mask_Editor_List_Remove (self);
+                break;
+/*          case GDK_KEY_Up:
+                Mask_Editor_Clist_Move_Up();
+                break;
+            case GDK_KEY_Down:
+                Mask_Editor_Clist_Move_Down();
+                break;
+*/      }
+    }
+    return TRUE;
+}
+
+/*
+ * Add a new mask to the list
+ */
+static void
+Mask_Editor_List_New (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    gchar *text;
+    GtkTreeIter iter;
+    GtkTreeSelection *selection;
+    GtkTreeModel *treemodel;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    text = _("New_mask");
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+
+    gtk_list_store_insert(GTK_LIST_STORE(treemodel), &iter, 0);
+    gtk_list_store_set(GTK_LIST_STORE(treemodel), &iter, MASK_EDITOR_TEXT, text, -1);
+
+    gtk_tree_selection_unselect_all(selection);
+    gtk_tree_selection_select_iter(selection, &iter);
+}
+
+/*
+ * Move all selected rows up one place in the mask list
+ */
+static void
+Mask_Editor_List_Move_Up (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    GtkTreeSelection *selection;
+    GList *selectedRows;
+    GList *l;
+    GtkTreeIter currentFile;
+    GtkTreeIter nextFile;
+    GtkTreePath *currentPath;
+    GtkTreeModel *treemodel;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+
+    if (!selectedRows)
+    {
+        Log_Print(LOG_ERROR,_("Move Up: No row selected"));
+        return;
+    }
+
+    for (l = selectedRows; l != NULL; l = g_list_next (l))
+    {
+        currentPath = (GtkTreePath *)l->data;
+        if (gtk_tree_model_get_iter(treemodel, &currentFile, currentPath))
+        {
+            /* Find the entry above the node... */
+            if (gtk_tree_path_prev(currentPath))
             {
-                return 0;
+                /* ...and if it exists, swap the two rows by iter */
+                gtk_tree_model_get_iter(treemodel, &nextFile, currentPath);
+                gtk_list_store_swap(GTK_LIST_STORE(treemodel), &currentFile, &nextFile);
             }
+        }
+    }
 
-            break;
+    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
+}
+
+/*
+ * Move all selected rows down one place in the mask list
+ */
+static void
+Mask_Editor_List_Move_Down (EtScanDialog *self)
+{
+    EtScanDialogPrivate *priv;
+    GtkTreeSelection *selection;
+    GList *selectedRows;
+    GList *l;
+    GtkTreeIter currentFile;
+    GtkTreeIter nextFile;
+    GtkTreePath *currentPath;
+    GtkTreeModel *treemodel;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+
+    if (!selectedRows)
+    {
+        Log_Print(LOG_ERROR,_("Move Down: No row selected"));
+        return;
+    }
+
+    for (l = selectedRows; l != NULL; l = g_list_next (l))
+    {
+        currentPath = (GtkTreePath *)l->data;
+
+        if (gtk_tree_model_get_iter(treemodel, &currentFile, currentPath))
+        {
+            /* Find the entry below the node and swap the two nodes by iter */
+            gtk_tree_path_next(currentPath);
+            if (gtk_tree_model_get_iter(treemodel, &nextFile, currentPath))
+                gtk_list_store_swap(GTK_LIST_STORE(treemodel), &currentFile, &nextFile);
         }
     }
 
-    /* Return length of found Roman numeral. */
-    return i - text;
+    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
 }
 
+/*
+ * Set a row visible in the mask editor list (by scrolling the list)
+ */
+static void
+Mask_Editor_List_Set_Row_Visible (GtkTreeView *view,
+                                  GtkTreeModel *treeModel,
+                                  GtkTreeIter *rowIter)
+{
+    /*
+     * TODO: Make this only scroll to the row if it is not visible
+     * (like in easytag GTK1)
+     * See function gtk_tree_view_get_visible_rect() ??
+     */
+    GtkTreePath *rowPath;
+
+    g_return_if_fail (treeModel != NULL);
+
+    rowPath = gtk_tree_model_get_path (treeModel, rowIter);
+    gtk_tree_view_scroll_to_cell (view, rowPath, NULL, FALSE, 0, 0);
+    gtk_tree_path_free (rowPath);
+}
 
 /*
- * Return the field of a 'File_Tag' structure corresponding to the mask code
+ * Duplicate a mask on the list
  */
-static gchar
-**Scan_Return_File_Tag_Field_From_Mask_Code (File_Tag *FileTag, gchar code)
+static void
+Mask_Editor_List_Duplicate (EtScanDialog *self)
 {
-    switch (code)
+    EtScanDialogPrivate *priv;
+    gchar *text = NULL;
+    GList *selectedRows;
+    GList *l;
+    GList *toInsert = NULL;
+    GtkTreeSelection *selection;
+    GtkTreeIter rowIter;
+    GtkTreeModel *treeModel;
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view));
+    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+    treeModel = gtk_tree_view_get_model(GTK_TREE_VIEW(priv->mask_editor_view));
+
+    if (!selectedRows)
     {
-        case 't':    /* Title */
-            return &FileTag->title;
-        case 'a':    /* Artist */
-            return &FileTag->artist;
-        case 'b':    /* Album */
-            return &FileTag->album;
-        case 'd':    /* Disc Number */
-            return &FileTag->disc_number;
-        case 'x': /* Total number of discs. */
-            return &FileTag->disc_total;
-        case 'y':    /* Year */
-            return &FileTag->year;
-        case 'n':    /* Track */
-            return &FileTag->track;
-        case 'l':    /* Track Total */
-            return &FileTag->track_total;
-        case 'g':    /* Genre */
-            return &FileTag->genre;
-        case 'c':    /* Comment */
-            return &FileTag->comment;
-        case 'p':    /* Composer */
-            return &FileTag->composer;
-        case 'o':    /* Orig. Artist */
-            return &FileTag->orig_artist;
-        case 'r':    /* Copyright */
-            return &FileTag->copyright;
-        case 'u':    /* URL */
-            return &FileTag->url;
-        case 'e':    /* Encoded by */
-            return &FileTag->encoded_by;
-        case 'z':    /* Album Artist */
-            return &FileTag->album_artist;
-        case 'i':    /* Ignored */
-            return NULL;
-        default:
-            Log_Print(LOG_ERROR,"Scanner: Invalid code '%%%c' found!",code);
-            return NULL;
+        Log_Print(LOG_ERROR,_("Copy: No row selected"));
+        return;
+    }
+
+    /* Loop through selected rows, duplicating them into a GList
+     * We cannot directly insert because the paths in selectedRows
+     * get out of date after an insertion */
+    for (l = selectedRows; l != NULL; l = g_list_next (l))
+    {
+        if (gtk_tree_model_get_iter (treeModel, &rowIter,
+                                     (GtkTreePath*)l->data))
+        {
+            gtk_tree_model_get(treeModel, &rowIter, MASK_EDITOR_TEXT, &text, -1);
+            toInsert = g_list_prepend (toInsert, text);
+        }
+    }
+
+    for (l = toInsert; l != NULL; l = g_list_next (l))
+    {
+        gtk_list_store_insert_with_values (GTK_LIST_STORE(treeModel), &rowIter,
+                                           0, MASK_EDITOR_TEXT,
+                                           (gchar *)l->data, -1);
+    }
+
+    /* Set focus to the last inserted line. */
+    if (toInsert)
+    {
+        Mask_Editor_List_Set_Row_Visible (GTK_TREE_VIEW (priv->mask_editor_view),
+                                          treeModel, &rowIter);
     }
+
+    /* Free data no longer needed */
+    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
+    g_list_free_full (toInsert, (GDestroyNotify)g_free);
 }
 
+static void
+Process_Fields_Convert_Check_Button_Toggled (EtScanDialog *self, GtkWidget *object)
+{
+    EtScanDialogPrivate *priv;
+
+    priv = et_scan_dialog_get_instance_private (self);
 
+    gtk_widget_set_sensitive (priv->process_convert_to_entry,
+                              gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(priv->process_convert_toggle)));
+    gtk_widget_set_sensitive (priv->process_convert_from_entry,
+                              gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(priv->process_convert_toggle)));
+}
 
-/******************
- * Scanner Window *
- ******************/
-void Open_ScannerWindow (gint scanner_type)
+static void
+create_scan_dialog (EtScanDialog *self)
 {
+    EtScanDialogPrivate *priv;
     GtkWidget *scan_button;
     GtkWidget *ScanVBox;
-    GtkWidget *HBox1, *HBox2, *HBox4, *VBox, *hbox, *vbox;
+    GtkWidget *HBox1, *HBox2, *HBox4, *VBox, *hbox, *mask_hbox, *vbox;
     GtkWidget *Table;
+    GtkWidget *scrolled_window;
     GtkWidget *Label;
     GtkWidget *Button;
     GIcon *new_folder;
@@ -1780,53 +2538,37 @@ void Open_ScannerWindow (gint scanner_type)
     GtkWidget *radio_space_none;
     GtkTreeViewColumn * column;
     GtkCellRenderer *renderer;
-    GtkToggleAction *toggle_action;
-
-    /* Check if already opened */
-    if (ScannerWindow)
-    {
-        //gdk_window_show(ScannerWindow->window);
-        gtk_window_present(GTK_WINDOW(ScannerWindow));
-        if (ScannerOptionCombo)
-        {
-            gtk_combo_box_set_active(GTK_COMBO_BOX(ScannerOptionCombo), scanner_type);
-        }
-        return;
-    }
 
-    if ( scanner_type < SCANNER_FILL_TAG
-    ||   scanner_type > SCANNER_PROCESS_FIELDS)
-        scanner_type = SCANNER_FILL_TAG;
+    priv = et_scan_dialog_get_instance_private (self);
 
     /* The window */
-    ScannerWindow = gtk_dialog_new_with_buttons (_("Tag and Filename Scan"),
-                                                 GTK_WINDOW (MainWindow),
-                                                 GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                 GTK_STOCK_CLOSE,
-                                                 GTK_RESPONSE_CLOSE, NULL);
+    gtk_window_set_title (GTK_WINDOW (self), _("Tag and Filename Scan"));
+    gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (MainWindow));
+    gtk_window_set_destroy_with_parent (GTK_WINDOW (self), TRUE);
+    gtk_dialog_add_buttons (GTK_DIALOG (self), GTK_STOCK_CLOSE,
+                            GTK_RESPONSE_CLOSE, NULL);
 
     /* 'Scan selected files' button */
     scan_button = gtk_button_new_from_stock (GTK_STOCK_APPLY);
     /* TODO: Set related action to match AM_SCAN_FILES. */
     gtk_button_set_label (GTK_BUTTON (scan_button), _("Scan Files"));
     gtk_widget_set_can_default (scan_button, TRUE);
-    gtk_dialog_add_action_widget (GTK_DIALOG (ScannerWindow), scan_button,
+    gtk_dialog_add_action_widget (GTK_DIALOG (self), scan_button,
                                   GTK_RESPONSE_APPLY);
-    gtk_dialog_set_default_response (GTK_DIALOG (ScannerWindow),
-                                     GTK_RESPONSE_APPLY);
+    gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_APPLY);
     gtk_widget_show (scan_button);
     gtk_widget_set_tooltip_text (scan_button, _("Scan selected files"));
 
     /* The response signal handles close, scan and the delete event. */
-    g_signal_connect (G_OBJECT (ScannerWindow), "response",
-                      G_CALLBACK (et_scan_on_response), NULL);
-
-    /* The init position is defined below, because the scanner window must be
-     * shown before it can be moved. */
+    g_signal_connect (self, "response", G_CALLBACK (et_scan_on_response),
+                      NULL);
+    g_signal_connect (self, "hide", G_CALLBACK (on_hide), NULL);
+    g_signal_connect (self, "delete-event",
+                      G_CALLBACK (gtk_widget_hide_on_delete), NULL);
 
     /* The main vbox */
-    ScanVBox = gtk_dialog_get_content_area (GTK_DIALOG (ScannerWindow));
-    gtk_container_set_border_width (GTK_CONTAINER (ScannerWindow), 6);
+    ScanVBox = gtk_dialog_get_content_area (GTK_DIALOG (self));
+    gtk_container_set_border_width (GTK_CONTAINER (self), 6);
     gtk_box_set_spacing (GTK_BOX (ScanVBox), 12);
 
     /*
@@ -1839,26 +2581,28 @@ void Open_ScannerWindow (gint scanner_type)
     Label = gtk_label_new(_("Scanner:"));
     gtk_box_pack_start(GTK_BOX(HBox1),Label,FALSE,FALSE,0);
 
-    ScannerOptionCombo = gtk_combo_box_text_new();
-    gtk_box_pack_start(GTK_BOX (HBox1), ScannerOptionCombo, TRUE, TRUE, 2);
-    gtk_widget_set_size_request(ScannerOptionCombo, 160, -1);
+    priv->type_combo = gtk_combo_box_text_new();
+    gtk_box_pack_start(GTK_BOX (HBox1), priv->type_combo, TRUE, TRUE, 2);
+    gtk_widget_set_size_request(priv->type_combo, 160, -1);
 
     /* Option for Tag */
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ScannerOptionCombo),
-                                   _(Scanner_Option_Menu_Items[SCANNER_FILL_TAG]));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->type_combo),
+                                   _(Scanner_Option_Menu_Items[ET_SCAN_TYPE_FILL_TAG]));
 
     /* Option for FileName */
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ScannerOptionCombo),
-                                   _(Scanner_Option_Menu_Items[SCANNER_RENAME_FILE]));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->type_combo),
+                                   _(Scanner_Option_Menu_Items[ET_SCAN_TYPE_RENAME_FILE]));
 
     /* Option for ProcessFields */
-    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ScannerOptionCombo),
-                              _(Scanner_Option_Menu_Items[SCANNER_PROCESS_FIELDS]));
+    gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(priv->type_combo),
+                              _(Scanner_Option_Menu_Items[ET_SCAN_TYPE_PROCESS_FIELDS]));
 
     /* Selection of the item made at the end of the function. */
-    gtk_widget_set_tooltip_text (ScannerOptionCombo,
+    gtk_widget_set_tooltip_text (priv->type_combo,
                                  _("Select the type of scanner to use"));
-    g_signal_connect(G_OBJECT(ScannerOptionCombo), "changed", G_CALLBACK(Scanner_Option_Menu_Activate_Item), 
NULL);
+    g_signal_connect_swapped (priv->type_combo, "changed",
+                              G_CALLBACK (Scanner_Option_Menu_Activate_Item),
+                              self);
 
     /* Options button */
     Button = gtk_button_new();
@@ -1870,159 +2614,168 @@ void Open_ScannerWindow (gint scanner_type)
     g_signal_connect(G_OBJECT(Button),"clicked",G_CALLBACK(Scan_Option_Button),NULL);
 
     /* Mask Editor button */
-    MaskEditorButton = gtk_toggle_button_new();
+    priv->mask_editor_toggle = gtk_toggle_button_new();
     Icon = gtk_image_new_from_stock("easytag-mask", GTK_ICON_SIZE_BUTTON);
-    gtk_container_add(GTK_CONTAINER(MaskEditorButton),Icon);
-    gtk_box_pack_start(GTK_BOX(HBox1),MaskEditorButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorButton,_("Show / Hide Masks Editor"));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(MaskEditorButton),SCAN_MASK_EDITOR_BUTTON);
-    g_signal_connect(G_OBJECT(MaskEditorButton),"toggled",G_CALLBACK(Scan_Toggle_Mask_Editor_Button),NULL);
+    gtk_container_add(GTK_CONTAINER(priv->mask_editor_toggle),Icon);
+    gtk_box_pack_start(GTK_BOX(HBox1),priv->mask_editor_toggle,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(priv->mask_editor_toggle),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(priv->mask_editor_toggle,_("Show / Hide Masks Editor"));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->mask_editor_toggle),SCAN_MASK_EDITOR_BUTTON);
+    g_signal_connect_swapped (priv->mask_editor_toggle, "toggled",
+                              G_CALLBACK (Scan_Toggle_Mask_Editor_Button),
+                              self);
 
     /* Legend button */
-    LegendButton = gtk_toggle_button_new();
+    priv->legend_toggle = gtk_toggle_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_HELP, GTK_ICON_SIZE_BUTTON);
-    gtk_container_add(GTK_CONTAINER(LegendButton),Icon);
-    gtk_box_pack_start(GTK_BOX(HBox1),LegendButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(LegendButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(LegendButton,_("Show / Hide Legend"));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(LegendButton),SCAN_LEGEND_BUTTON);
-    g_signal_connect(G_OBJECT(LegendButton),"toggled",G_CALLBACK(Scan_Toggle_Legend_Button),NULL);
+    gtk_container_add(GTK_CONTAINER(priv->legend_toggle),Icon);
+    gtk_box_pack_start(GTK_BOX(HBox1),priv->legend_toggle,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(priv->legend_toggle),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(priv->legend_toggle,_("Show / Hide Legend"));
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->legend_toggle),SCAN_LEGEND_BUTTON);
+    g_signal_connect_swapped (priv->legend_toggle, "toggled",
+                              G_CALLBACK (Scan_Toggle_Legend_Button),
+                              self);
 
     /*
      * Frame for Scan Tag
      */
-    ScanTagFrame = gtk_frame_new (_(Scanner_Option_Menu_Items[0]));
-    gtk_box_pack_start(GTK_BOX(ScanVBox),ScanTagFrame,FALSE,FALSE,0);
+    priv->scan_tag_frame = gtk_frame_new (_(Scanner_Option_Menu_Items[0]));
+    gtk_box_pack_start(GTK_BOX(ScanVBox),priv->scan_tag_frame,FALSE,FALSE,0);
 
     vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(ScanTagFrame),vbox);
-    gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
-    gtk_widget_show(vbox);
+    gtk_container_add (GTK_CONTAINER (priv->scan_tag_frame), vbox);
+    gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
+    gtk_widget_show (vbox);
 
     /* The combo box + Status icon */
     HBox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
     gtk_box_pack_start(GTK_BOX(vbox),HBox2,TRUE,TRUE,0);
 
     // Set up list model which is used both by the combobox and the editor
-    ScanTagListModel = gtk_list_store_new(MASK_EDITOR_COUNT, G_TYPE_STRING);
+    priv->scan_tag_masks_model = gtk_list_store_new(MASK_EDITOR_COUNT, G_TYPE_STRING);
 
     // The combo box to select the mask to apply
-    ScanTagMaskCombo = gtk_combo_box_new_with_entry();
-    gtk_combo_box_set_model(GTK_COMBO_BOX(ScanTagMaskCombo), GTK_TREE_MODEL(ScanTagListModel));
-    g_object_unref (ScanTagListModel);
-    gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(ScanTagMaskCombo), MASK_EDITOR_TEXT);
+    priv->scan_tag_mask_combo = gtk_combo_box_new_with_entry();
+    gtk_combo_box_set_model(GTK_COMBO_BOX(priv->scan_tag_mask_combo), 
GTK_TREE_MODEL(priv->scan_tag_masks_model));
+    g_object_unref (priv->scan_tag_masks_model);
+    gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(priv->scan_tag_mask_combo), MASK_EDITOR_TEXT);
 
-    gtk_box_pack_start(GTK_BOX(HBox2),ScanTagMaskCombo,TRUE,TRUE,2);
-    gtk_widget_set_tooltip_text(GTK_WIDGET(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo)))),
+    gtk_box_pack_start(GTK_BOX(HBox2),priv->scan_tag_mask_combo,TRUE,TRUE,2);
+    gtk_widget_set_tooltip_text(GTK_WIDGET(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo)))),
         _("Select or type in a mask using codes (see Legend) to parse "
         "filename and path. Used to fill in tag fields"));
-    // Signal to generate preview (preview of the new tag values)
-    g_signal_connect_swapped(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo)))),"changed",
-        G_CALLBACK(Scan_Fill_Tag_Generate_Preview),NULL);
+    /* Signal to generate preview (preview of the new tag values). */
+    g_signal_connect_swapped (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->scan_tag_mask_combo))),
+                              "changed",
+                              G_CALLBACK (Scan_Fill_Tag_Generate_Preview),
+                              self);
 
     // Load masks into the combobox from a file
-    Load_Scan_Tag_Masks_List(ScanTagListModel, MASK_EDITOR_TEXT, Scan_Masks);
+    Load_Scan_Tag_Masks_List(priv->scan_tag_masks_model, MASK_EDITOR_TEXT, Scan_Masks);
     if (SCAN_TAG_DEFAULT_MASK)
     {
-        Add_String_To_Combo_List(ScanTagListModel, SCAN_TAG_DEFAULT_MASK);
-        gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo))), SCAN_TAG_DEFAULT_MASK);
+        Add_String_To_Combo_List(priv->scan_tag_masks_model, SCAN_TAG_DEFAULT_MASK);
+        gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo))), 
SCAN_TAG_DEFAULT_MASK);
     }else
     {
-        gtk_combo_box_set_active(GTK_COMBO_BOX(ScanTagMaskCombo), 0);
+        gtk_combo_box_set_active(GTK_COMBO_BOX(priv->scan_tag_mask_combo), 0);
     }
 
     // Mask status icon
     // Signal connection to check if mask is correct into the mask entry
-    g_signal_connect (gtk_bin_get_child (GTK_BIN (ScanTagMaskCombo)),
+    g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->scan_tag_mask_combo)),
                       "changed", G_CALLBACK (entry_check_scan_tag_mask),
                       NULL);
 
-    // Preview label
-    FillTagPreviewLabel = gtk_label_new (_("Fill tag preview"));
-    gtk_label_set_line_wrap(GTK_LABEL(FillTagPreviewLabel),TRUE);
-    gtk_widget_show(FillTagPreviewLabel);
-    gtk_box_pack_start(GTK_BOX(vbox),FillTagPreviewLabel,TRUE,TRUE,0);
+    /* Preview label. */
+    priv->fill_tag_preview_label = gtk_label_new (_("Fill tag preview"));
+    gtk_label_set_line_wrap(GTK_LABEL(priv->fill_tag_preview_label),TRUE);
+    gtk_widget_show(priv->fill_tag_preview_label);
+    gtk_box_pack_start(GTK_BOX(vbox),priv->fill_tag_preview_label,TRUE,TRUE,0);
 
     /*
      * Frame for Rename File
      */
-    RenameFileFrame = gtk_frame_new (_(Scanner_Option_Menu_Items[1]));
-    gtk_box_pack_start(GTK_BOX(ScanVBox),RenameFileFrame,FALSE,FALSE,0);
+    priv->rename_file_frame = gtk_frame_new (_(Scanner_Option_Menu_Items[1]));
+    gtk_box_pack_start(GTK_BOX(ScanVBox),priv->rename_file_frame,FALSE,FALSE,0);
 
-    vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,4);
-    gtk_container_add(GTK_CONTAINER(RenameFileFrame),vbox);
-    gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
-    gtk_widget_show(vbox);
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
+    gtk_container_add (GTK_CONTAINER (priv->rename_file_frame), vbox);
+    gtk_container_set_border_width (GTK_CONTAINER (vbox), BOX_SPACING);
+    gtk_widget_show (vbox);
 
     /* The button to prefix path + combo box + Status icon */
     HBox4 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2);
     gtk_box_pack_start(GTK_BOX(vbox),HBox4,TRUE,TRUE,0);
 
     // Button to prefix path
-    RenameFilePrefixPathButton = gtk_button_new();
+    Button = gtk_button_new();
     new_folder = g_themed_icon_new ("folder-new");
     /* TODO: On Win32, GTK_ICON_SIZE_BUTTON enlarges the combobox. */
     Icon = gtk_image_new_from_gicon (new_folder, GTK_ICON_SIZE_MENU);
     g_object_unref (new_folder);
-    gtk_container_add(GTK_CONTAINER(RenameFilePrefixPathButton),Icon);
-    gtk_box_pack_start(GTK_BOX(HBox4),RenameFilePrefixPathButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(RenameFilePrefixPathButton),GTK_RELIEF_NONE);
-    
g_signal_connect(G_OBJECT(RenameFilePrefixPathButton),"clicked",G_CALLBACK(Scan_Rename_File_Prefix_Path),NULL);
-    gtk_widget_set_tooltip_text(RenameFilePrefixPathButton,_("Prefix mask with current path"));
+    gtk_container_add (GTK_CONTAINER (Button), Icon);
+    gtk_box_pack_start (GTK_BOX (HBox4), Button, FALSE, FALSE, 0);
+    gtk_button_set_relief (GTK_BUTTON (Button), GTK_RELIEF_NONE);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Scan_Rename_File_Prefix_Path), self);
+    gtk_widget_set_tooltip_text (Button, _("Prefix mask with current path"));
 
     // Set up list model which is used both by the combobox and the editor
-    RenameFileListModel = gtk_list_store_new(MASK_EDITOR_COUNT, G_TYPE_STRING);
+    priv->rename_masks_model = gtk_list_store_new(MASK_EDITOR_COUNT, G_TYPE_STRING);
 
     // The combo box to select the mask to apply
-    RenameFileMaskCombo = gtk_combo_box_new_with_entry();
-    gtk_combo_box_set_model(GTK_COMBO_BOX(RenameFileMaskCombo), GTK_TREE_MODEL(RenameFileListModel));
-    g_object_unref (RenameFileListModel);
-    gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(RenameFileMaskCombo), MASK_EDITOR_TEXT);
+    priv->rename_file_mask_combo = gtk_combo_box_new_with_entry();
+    gtk_combo_box_set_model(GTK_COMBO_BOX(priv->rename_file_mask_combo), 
GTK_TREE_MODEL(priv->rename_masks_model));
+    g_object_unref (priv->rename_masks_model);
+    gtk_combo_box_set_entry_text_column(GTK_COMBO_BOX(priv->rename_file_mask_combo), MASK_EDITOR_TEXT);
 
-    gtk_box_pack_start(GTK_BOX(HBox4),RenameFileMaskCombo,TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(HBox4),priv->rename_file_mask_combo,TRUE,TRUE,2);
     gtk_container_set_border_width(GTK_CONTAINER(HBox4), 2);
-    gtk_widget_set_tooltip_text(GTK_WIDGET(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo)))),
+    
gtk_widget_set_tooltip_text(GTK_WIDGET(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo)))),
         _("Select or type in a mask using codes (see Legend) to parse tag fields. "
         "Used to rename the file.\nUse / to make directories. If the first character "
         "is /, it's a absolute path, otherwise is relative to the old path."));
     // Signal to generate preview (preview of the new filename)
-    g_signal_connect_swapped(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo)))),"changed",
-        G_CALLBACK(Scan_Rename_File_Generate_Preview),NULL);
+    g_signal_connect_swapped (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->rename_file_mask_combo))),
+                              "changed",
+                              G_CALLBACK (Scan_Rename_File_Generate_Preview),
+                              self);
 
     // Load masks into the combobox from a file
-    Load_Rename_File_Masks_List(RenameFileListModel, MASK_EDITOR_TEXT, Rename_File_Masks);
+    Load_Rename_File_Masks_List(priv->rename_masks_model, MASK_EDITOR_TEXT, Rename_File_Masks);
     if (RENAME_FILE_DEFAULT_MASK)
     {
-        Add_String_To_Combo_List(RenameFileListModel, RENAME_FILE_DEFAULT_MASK);
-        gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo))), 
RENAME_FILE_DEFAULT_MASK);
+        Add_String_To_Combo_List(priv->rename_masks_model, RENAME_FILE_DEFAULT_MASK);
+        gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo))), 
RENAME_FILE_DEFAULT_MASK);
     }else
     {
-        gtk_combo_box_set_active(GTK_COMBO_BOX(RenameFileMaskCombo), 0);
+        gtk_combo_box_set_active(GTK_COMBO_BOX(priv->rename_file_mask_combo), 0);
     }
 
     // Mask status icon
     // Signal connection to check if mask is correct into the mask entry
-    g_signal_connect (gtk_bin_get_child (GTK_BIN (RenameFileMaskCombo)),
+    g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->rename_file_mask_combo)),
                       "changed", G_CALLBACK (entry_check_rename_file_mask),
                       NULL);
 
     /* Preview label */
-    RenameFilePreviewLabel = gtk_label_new (_("Rename file preview"));
-    gtk_label_set_line_wrap(GTK_LABEL(RenameFilePreviewLabel),TRUE);
-    gtk_widget_show(RenameFilePreviewLabel);
-    gtk_box_pack_start(GTK_BOX(vbox),RenameFilePreviewLabel,TRUE,TRUE,0);
+    priv->rename_file_preview_label = gtk_label_new (_("Rename file preview"));
+    gtk_label_set_line_wrap(GTK_LABEL(priv->rename_file_preview_label),TRUE);
+    gtk_widget_show(priv->rename_file_preview_label);
+    gtk_box_pack_start(GTK_BOX(vbox),priv->rename_file_preview_label,TRUE,TRUE,0);
 
     /*
      * Frame for Processing Fields
      */
-    ProcessFieldsFrame = gtk_frame_new (_(Scanner_Option_Menu_Items[2]));
-    gtk_box_pack_start(GTK_BOX(ScanVBox),ProcessFieldsFrame,FALSE,FALSE,0);
+    priv->process_fields_frame = gtk_frame_new (_(Scanner_Option_Menu_Items[2]));
+    gtk_box_pack_start(GTK_BOX(ScanVBox),priv->process_fields_frame,FALSE,FALSE,0);
 
     VBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, BOX_SPACING);
-    gtk_container_add(GTK_CONTAINER(ProcessFieldsFrame),VBox);
-    gtk_container_set_border_width(GTK_CONTAINER(VBox), 4);
-    gtk_widget_show(VBox);
+    gtk_container_add (GTK_CONTAINER (priv->process_fields_frame), VBox);
+    gtk_container_set_border_width (GTK_CONTAINER (VBox), BOX_SPACING);
+    gtk_widget_show (VBox);
 
     /* Group: select entry fields to process */
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
@@ -2034,88 +2787,94 @@ void Open_ScannerWindow (gint scanner_type)
                                    "fields which can be processed. Select "
                                    "those which interest you"));
     // Advice for Translators: set the first letter of filename translated
-    ProcessFileNameField = gtk_toggle_button_new_with_label(   _("F"));
-    gtk_widget_set_tooltip_text (ProcessFileNameField,
+    priv->process_filename_toggle = gtk_toggle_button_new_with_label(   _("F"));
+    gtk_widget_set_tooltip_text (priv->process_filename_toggle,
                                  _("Process filename field"));
     // Advice for Translators: set the first letter of title translated
-    ProcessTitleField = gtk_toggle_button_new_with_label(      _("T"));
-    gtk_widget_set_tooltip_text(ProcessTitleField,             _("Process title field"));
+    priv->process_title_toggle = gtk_toggle_button_new_with_label(      _("T"));
+    gtk_widget_set_tooltip_text(priv->process_title_toggle,             _("Process title field"));
     // Advice for Translators: set the first letter of artist translated
-    ProcessArtistField = gtk_toggle_button_new_with_label(     _("Ar"));
-    gtk_widget_set_tooltip_text(ProcessArtistField,            _("Process file artist field"));
+    priv->process_artist_toggle = gtk_toggle_button_new_with_label(     _("Ar"));
+    gtk_widget_set_tooltip_text(priv->process_artist_toggle,            _("Process file artist field"));
     // Advice for Translators: set the first letter of album artist translated
-    ProcessAlbumArtistField = gtk_toggle_button_new_with_label(_("AA"));
-    gtk_widget_set_tooltip_text(ProcessAlbumArtistField,       _("Process album artist field"));
+    priv->process_album_artist_toggle = gtk_toggle_button_new_with_label(_("AA"));
+    gtk_widget_set_tooltip_text(priv->process_album_artist_toggle,       _("Process album artist field"));
     // Advice for Translators: set the first letter of album translated
-    ProcessAlbumField = gtk_toggle_button_new_with_label(      _("Al"));
-    gtk_widget_set_tooltip_text(ProcessAlbumField,             _("Process album field"));
+    priv->process_album_toggle = gtk_toggle_button_new_with_label(      _("Al"));
+    gtk_widget_set_tooltip_text(priv->process_album_toggle,             _("Process album field"));
     // Advice for Translators: set the first letter of genre translated
-    ProcessGenreField = gtk_toggle_button_new_with_label(      _("G"));
-    gtk_widget_set_tooltip_text(ProcessGenreField,             _("Process genre field"));
+    priv->process_genre_toggle = gtk_toggle_button_new_with_label(      _("G"));
+    gtk_widget_set_tooltip_text(priv->process_genre_toggle,             _("Process genre field"));
     // Advice for Translators: set the first letter of comment translated
-    ProcessCommentField = gtk_toggle_button_new_with_label(    _("Cm"));
-    gtk_widget_set_tooltip_text(ProcessCommentField,           _("Process comment field"));
+    priv->process_comment_toggle = gtk_toggle_button_new_with_label(    _("Cm"));
+    gtk_widget_set_tooltip_text(priv->process_comment_toggle,           _("Process comment field"));
     // Advice for Translators: set the first letter of composer translated
-    ProcessComposerField = gtk_toggle_button_new_with_label(   _("Cp"));
-    gtk_widget_set_tooltip_text(ProcessComposerField,          _("Process composer field"));
+    priv->process_composer_toggle = gtk_toggle_button_new_with_label(   _("Cp"));
+    gtk_widget_set_tooltip_text(priv->process_composer_toggle,          _("Process composer field"));
     // Advice for Translators: set the first letter of orig artist translated
-    ProcessOrigArtistField = gtk_toggle_button_new_with_label( _("O"));
-    gtk_widget_set_tooltip_text(ProcessOrigArtistField,        _("Process original artist field"));
+    priv->process_original_artist_toggle = gtk_toggle_button_new_with_label( _("O"));
+    gtk_widget_set_tooltip_text(priv->process_original_artist_toggle,        _("Process original artist 
field"));
     // Advice for Translators: set the first letter of copyright translated
-    ProcessCopyrightField = gtk_toggle_button_new_with_label(  _("Cr"));
-    gtk_widget_set_tooltip_text(ProcessCopyrightField,         _("Process copyright field"));
+    priv->process_copyright_toggle = gtk_toggle_button_new_with_label(  _("Cr"));
+    gtk_widget_set_tooltip_text(priv->process_copyright_toggle,         _("Process copyright field"));
     // Advice for Translators: set the first letter of URL translated
-    ProcessURLField = gtk_toggle_button_new_with_label(        _("U"));
-    gtk_widget_set_tooltip_text(ProcessURLField,               _("Process URL field"));
+    priv->process_url_toggle = gtk_toggle_button_new_with_label(        _("U"));
+    gtk_widget_set_tooltip_text(priv->process_url_toggle,               _("Process URL field"));
     // Advice for Translators: set the first letter of encoder name translated
-    ProcessEncodedByField = gtk_toggle_button_new_with_label(  _("E"));
-    gtk_widget_set_tooltip_text(ProcessEncodedByField,         _("Process encoder name field"));
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFileNameField,   TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessTitleField,      TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessArtistField,     TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessAlbumArtistField,TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessAlbumField,      TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessGenreField,      TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessCommentField,    TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessComposerField,   TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessOrigArtistField, TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessCopyrightField,  TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessURLField,        TRUE,TRUE,2);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessEncodedByField,  TRUE,TRUE,2);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessFileNameField),   PROCESS_FILENAME_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessTitleField),      PROCESS_TITLE_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessArtistField),     PROCESS_ARTIST_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField),PROCESS_ALBUM_ARTIST_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessAlbumField),      PROCESS_ALBUM_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessGenreField),      PROCESS_GENRE_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessCommentField),    PROCESS_COMMENT_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessComposerField),   PROCESS_COMPOSER_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField), PROCESS_ORIG_ARTIST_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField),  PROCESS_COPYRIGHT_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessURLField),        PROCESS_URL_FIELD);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField),  PROCESS_ENCODED_BY_FIELD);
-    g_signal_connect(G_OBJECT(ProcessFileNameField),   
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessTitleField),      
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessArtistField),     
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    
g_signal_connect(G_OBJECT(ProcessAlbumArtistField),"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessAlbumField),      
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessGenreField),      
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessCommentField),    
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessComposerField),   
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessOrigArtistField), 
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessCopyrightField),  
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessURLField),        
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
-    g_signal_connect(G_OBJECT(ProcessEncodedByField),  
"toggled",G_CALLBACK(Select_Fields_Set_Sensitive),NULL);
+    priv->process_encoded_by_toggle = gtk_toggle_button_new_with_label(  _("E"));
+    gtk_widget_set_tooltip_text(priv->process_encoded_by_toggle,         _("Process encoder name field"));
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_filename_toggle,   TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_title_toggle,      TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_artist_toggle,     TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_album_artist_toggle,TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_album_toggle,      TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_genre_toggle,      TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_comment_toggle,    TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_composer_toggle,   TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_original_artist_toggle, TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_copyright_toggle,  TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_url_toggle,        TRUE,TRUE,2);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_encoded_by_toggle,  TRUE,TRUE,2);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle),   PROCESS_FILENAME_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle),      PROCESS_TITLE_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle),     PROCESS_ARTIST_FIELD);
+    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle),PROCESS_ALBUM_ARTIST_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle),      PROCESS_ALBUM_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle),      PROCESS_GENRE_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle),    PROCESS_COMMENT_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle),   PROCESS_COMPOSER_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle), 
PROCESS_ORIG_ARTIST_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle),  
PROCESS_COPYRIGHT_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle),        PROCESS_URL_FIELD);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle),  
PROCESS_ENCODED_BY_FIELD);
+    g_signal_connect_swapped  (priv->process_filename_toggle, "toggled",
+                               G_CALLBACK (Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_title_toggle, "toggled",
+                              G_CALLBACK (Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_artist_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_album_artist_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_album_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_genre_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_comment_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_composer_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_original_artist_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_copyright_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
+    g_signal_connect_swapped (priv->process_url_toggle, "toggled", G_CALLBACK (Select_Fields_Set_Sensitive), 
self);
+    g_signal_connect_swapped (priv->process_encoded_by_toggle, "toggled", G_CALLBACK 
(Select_Fields_Set_Sensitive), self);
     /* The small buttons */
     Button = gtk_button_new();
-    g_signal_connect(G_OBJECT(Button),"clicked",G_CALLBACK(Select_Fields_Invert_Selection),NULL);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Select_Fields_Invert_Selection),
+                              self);
     gtk_box_pack_end (GTK_BOX(hbox), Button, FALSE, FALSE, 0);
     Icon = gtk_image_new_from_stock ("easytag-invert-selection",
                                      GTK_ICON_SIZE_BUTTON);
     gtk_container_add(GTK_CONTAINER(Button),Icon);
     gtk_widget_set_tooltip_text (Button, _("Invert selection"));
     Button = gtk_button_new();
-    g_signal_connect(G_OBJECT(Button),"clicked",G_CALLBACK(Select_Fields_Select_Unselect_All),NULL);
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Select_Fields_Select_Unselect_All),
+                              self);
     gtk_box_pack_end (GTK_BOX(hbox), Button, FALSE, FALSE, 0);
     Icon = gtk_image_new_from_icon_name ("edit-select-all",
                                          GTK_ICON_SIZE_BUTTON);
@@ -2125,46 +2884,51 @@ void Open_ScannerWindow (gint scanner_type)
     /* Group: character conversion */
     group = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_pack_start (GTK_BOX (VBox), group, FALSE, FALSE, 0);
-    ProcessFieldsConvertIntoSpace = gtk_radio_button_new_with_label_from_widget (NULL, _("Convert '_' and 
'%20' to spaces"));
-    ProcessFieldsConvertSpace = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsConvertIntoSpace),
+    priv->process_convert_to_space_toggle = gtk_radio_button_new_with_label_from_widget (NULL, _("Convert 
'_' and '%20' to spaces"));
+    priv->process_convert_to_underscores_toggle = gtk_radio_button_new_with_label_from_widget 
(GTK_RADIO_BUTTON (priv->process_convert_to_space_toggle),
                                                                              _("Convert ' ' to '_'"));
-    gtk_box_pack_start (GTK_BOX (group), ProcessFieldsConvertIntoSpace, FALSE,
+    gtk_box_pack_start (GTK_BOX (group), priv->process_convert_to_space_toggle, FALSE,
                         FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (group), ProcessFieldsConvertSpace, FALSE,
+    gtk_box_pack_start (GTK_BOX (group), priv->process_convert_to_underscores_toggle, FALSE,
                         FALSE, 0);
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2);
     gtk_box_pack_start (GTK_BOX (group), hbox, FALSE, FALSE, 0);
-    ProcessFieldsConvert = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsConvertIntoSpace),
+    priv->process_convert_toggle = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_convert_to_space_toggle),
                                                                         _("Convert:"));
-    ProcessFieldsConvertTo        = gtk_entry_new();
-    ProcessFieldsConvertLabelTo   = gtk_label_new(_("to: ")); // A "space" at the end to allow another 
translation for "to :" (needed in French!)
-    ProcessFieldsConvertFrom      = gtk_entry_new();
-    //gtk_entry_set_max_length(GTK_ENTRY(ProcessFieldsConvertTo), 1); // Now, it isn't limited to one 
character
-    //gtk_entry_set_max_length(GTK_ENTRY(ProcessFieldsConvertFrom), 1);
-    gtk_widget_set_size_request(ProcessFieldsConvertTo,120,-1);
-    gtk_widget_set_size_request(ProcessFieldsConvertFrom,120,-1);
-    process_fields_convert_none = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsConvertIntoSpace),
+    priv->process_convert_to_entry        = gtk_entry_new();
+    /* FIXME Use translation context. A "space" at the end to allow another
+     * translation for "to :" (needed in French!) */
+    priv->process_convert_label = gtk_label_new (_("to: "));
+    priv->process_convert_from_entry      = gtk_entry_new();
+    //gtk_entry_set_max_length(GTK_ENTRY(priv->process_convert_to_entry), 1); // Now, it isn't limited to 
one character
+    //gtk_entry_set_max_length(GTK_ENTRY(priv->process_convert_from_entry), 1);
+    gtk_widget_set_size_request(priv->process_convert_to_entry,120,-1);
+    gtk_widget_set_size_request(priv->process_convert_from_entry,120,-1);
+    process_fields_convert_none = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_convert_to_space_toggle),
                                                                                _("Do not convert"));
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFieldsConvert,       FALSE,FALSE,0);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFieldsConvertFrom,   FALSE,FALSE,0);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFieldsConvertLabelTo,FALSE,FALSE,0);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFieldsConvertTo,     FALSE,FALSE,0);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_convert_toggle,       FALSE,FALSE,0);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_convert_from_entry,   FALSE,FALSE,0);
+    gtk_box_pack_start (GTK_BOX (hbox), priv->process_convert_label, FALSE,
+                        FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_convert_to_entry,     FALSE,FALSE,0);
     gtk_box_pack_start (GTK_BOX (group), process_fields_convert_none, FALSE,
                         FALSE, 0);
     if (PROCESS_FIELDS_CONVERT_FROM)
-        gtk_entry_set_text(GTK_ENTRY(ProcessFieldsConvertFrom),PROCESS_FIELDS_CONVERT_FROM);
+        gtk_entry_set_text(GTK_ENTRY(priv->process_convert_from_entry),PROCESS_FIELDS_CONVERT_FROM);
     if (PROCESS_FIELDS_CONVERT_TO)
-        gtk_entry_set_text(GTK_ENTRY(ProcessFieldsConvertTo),PROCESS_FIELDS_CONVERT_TO);
+        gtk_entry_set_text(GTK_ENTRY(priv->process_convert_to_entry),PROCESS_FIELDS_CONVERT_TO);
     /* Toggled signals */
-    g_signal_connect(G_OBJECT(ProcessFieldsConvert),         
"toggled",G_CALLBACK(Process_Fields_Convert_Check_Button_Toggled),NULL);
+    g_signal_connect_swapped (priv->process_convert_toggle, "toggled",
+                              G_CALLBACK (Process_Fields_Convert_Check_Button_Toggled),
+                              self);
     /* Set check buttons to init value */
     if (PF_CONVERT_INTO_SPACE || PF_CONVERT_SPACE || PF_CONVERT)
     {
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsConvertIntoSpace),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_convert_to_space_toggle),
                                       PF_CONVERT_INTO_SPACE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsConvertSpace),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_convert_to_underscores_toggle),
                                       PF_CONVERT_SPACE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsConvert),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_convert_toggle),
                                       PF_CONVERT);
     }
     else
@@ -2173,13 +2937,13 @@ void Open_ScannerWindow (gint scanner_type)
                                       TRUE);
     }
     /* Tooltips */
-    gtk_widget_set_tooltip_text(ProcessFieldsConvertIntoSpace,
+    gtk_widget_set_tooltip_text(priv->process_convert_to_space_toggle,
         _("The underscore character or the string '%20' are replaced by one space. "
           "Example, before: 'Text%20In%20An_Entry', after: 'Text In An Entry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsConvertSpace,
+    gtk_widget_set_tooltip_text(priv->process_convert_to_underscores_toggle,
         _("The space character is replaced by one underscore character. "
           "Example, before: 'Text In An Entry', after: 'Text_In_An_Entry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsConvert,
+    gtk_widget_set_tooltip_text(priv->process_convert_toggle,
         _("Replace a string by another one. Note that the search is case sensitive."));
 
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
@@ -2187,90 +2951,96 @@ void Open_ScannerWindow (gint scanner_type)
     /* Group: capitalize, ... */
     group = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_pack_start (GTK_BOX (VBox), group, FALSE, FALSE, 0);
-    ProcessFieldsAllUppercase = gtk_radio_button_new_with_label_from_widget (NULL, _("Capitalize all"));
-    ProcessFieldsAllDowncase  = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsAllUppercase),
+    priv->process_all_uppercase_toggle = gtk_radio_button_new_with_label_from_widget (NULL, _("Capitalize 
all"));
+    priv->process_all_lowercase_toggle  = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_all_uppercase_toggle),
                                                                              _("Lowercase all"));
-    ProcessFieldsFirstLetterUppercase  = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsAllUppercase),
+    priv->process_first_uppercase_toggle  = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_all_uppercase_toggle),
                                                                                       _("Capitalize first 
letter"));
-    ProcessFieldsFirstLettersUppercase = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsAllUppercase),
+    priv->process_first_style_uppercase_toggle = gtk_radio_button_new_with_label_from_widget 
(GTK_RADIO_BUTTON (priv->process_all_uppercase_toggle),
                                                                                       _("Capitalize the 
first letter of each word"));
-    ProcessFieldsDetectRomanNumerals = gtk_check_button_new_with_label(_("Detect Roman numerals"));
-    process_fields_case_none = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsAllUppercase),
+    priv->process_roman_numerals_check = gtk_check_button_new_with_label(_("Detect Roman numerals"));
+    process_fields_case_none = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_all_uppercase_toggle),
                                                                             _("Do not change 
capitalization"));
-    gtk_box_pack_start (GTK_BOX (group), ProcessFieldsAllUppercase, FALSE,
+    gtk_box_pack_start (GTK_BOX (group), priv->process_all_uppercase_toggle, FALSE,
                         FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (group),ProcessFieldsAllDowncase, FALSE, FALSE,
+    gtk_box_pack_start (GTK_BOX (group),priv->process_all_lowercase_toggle, FALSE, FALSE,
                         0);
-    gtk_box_pack_start (GTK_BOX (group),ProcessFieldsFirstLetterUppercase,
+    gtk_box_pack_start (GTK_BOX (group),priv->process_first_uppercase_toggle,
                         FALSE, FALSE, 0);
     gtk_box_pack_start (GTK_BOX (group), hbox, FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFieldsFirstLettersUppercase,FALSE,FALSE,0);
-    gtk_box_pack_start(GTK_BOX(hbox),ProcessFieldsDetectRomanNumerals,FALSE,FALSE,0);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_first_style_uppercase_toggle,FALSE,FALSE,0);
+    gtk_box_pack_start(GTK_BOX(hbox),priv->process_roman_numerals_check,FALSE,FALSE,0);
     gtk_box_pack_start (GTK_BOX (group), process_fields_case_none, FALSE,
                         FALSE, 0);
     /* Toggled signals */
-    
g_signal_connect(G_OBJECT(ProcessFieldsFirstLettersUppercase),"toggled",G_CALLBACK(Process_Fields_First_Letters_Check_Button_Toggled),NULL);
+    g_signal_connect_swapped (priv->process_first_style_uppercase_toggle,
+                              "toggled",
+                              G_CALLBACK (Process_Fields_First_Letters_Check_Button_Toggled),
+                              self);
     /* Set check buttons to init value */
     if (PF_CONVERT_ALL_UPPERCASE || PF_CONVERT_ALL_DOWNCASE
         || PF_CONVERT_FIRST_LETTER_UPPERCASE
         || PF_CONVERT_FIRST_LETTERS_UPPERCASE)
     {
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsAllUppercase),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_all_uppercase_toggle),
                                       PF_CONVERT_ALL_UPPERCASE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsAllDowncase),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_all_lowercase_toggle),
                                       PF_CONVERT_ALL_DOWNCASE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsFirstLetterUppercase),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_first_uppercase_toggle),
                                       PF_CONVERT_FIRST_LETTER_UPPERCASE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsFirstLettersUppercase),
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_first_style_uppercase_toggle),
                                       PF_CONVERT_FIRST_LETTERS_UPPERCASE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsDetectRomanNumerals),
-                                      PF_DETECT_ROMAN_NUMERALS);
     }
     else
     {
         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (process_fields_case_none),
                                       TRUE);
     }
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_roman_numerals_check),
+                                  PF_DETECT_ROMAN_NUMERALS);
     /* Tooltips */
-    gtk_widget_set_tooltip_text(ProcessFieldsAllUppercase,
+    gtk_widget_set_tooltip_text(priv->process_all_uppercase_toggle,
         _("Convert all words in all fields to upper case. "
           "Example, before: 'Text IN AN entry', after: 'TEXT IN AN ENTRY'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsAllDowncase,
+    gtk_widget_set_tooltip_text(priv->process_all_lowercase_toggle,
         _("Convert all words in all fields to lower case. "
           "Example, before: 'TEXT IN an entry', after: 'text in an entry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsFirstLetterUppercase,
+    gtk_widget_set_tooltip_text(priv->process_first_uppercase_toggle,
         _("Convert the initial of the first word in all fields to upper case. "
           "Example, before: 'text IN An ENTRY', after: 'Text in an entry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsFirstLettersUppercase,
+    gtk_widget_set_tooltip_text(priv->process_first_style_uppercase_toggle,
         _("Convert the initial of each word in all fields to upper case. "
           "Example, before: 'Text in an ENTRY', after: 'Text In An Entry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsDetectRomanNumerals,
+    gtk_widget_set_tooltip_text(priv->process_roman_numerals_check,
         _("Force to convert to upper case the Roman numerals. "
           "Example, before: 'ix. text in an entry', after: 'IX. Text In An Entry'."));
 
     /* Group: insert/remove spaces */
     group = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
     gtk_box_pack_start (GTK_BOX (VBox), group, FALSE, FALSE, 0);
-    ProcessFieldsRemoveSpace = gtk_radio_button_new_with_label_from_widget (NULL, _("Remove spaces"));
-    ProcessFieldsInsertSpace = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsRemoveSpace),
+    priv->process_remove_space_toggle = gtk_radio_button_new_with_label_from_widget (NULL, _("Remove 
spaces"));
+    priv->process_insert_space_toggle = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_remove_space_toggle),
                                                                             _("Insert a space before 
uppercase letters"));
-    ProcessFieldsOnlyOneSpace = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsRemoveSpace),
+    priv->process_insert_one_space_toggle = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_remove_space_toggle),
                                                                              _("Remove duplicate spaces and 
underscores"));
-    radio_space_none = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(ProcessFieldsRemoveSpace),
+    radio_space_none = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON 
(priv->process_remove_space_toggle),
                                                                     _("Do not change word separators"));
-    gtk_box_pack_start (GTK_BOX (group), ProcessFieldsRemoveSpace, FALSE,
+    gtk_box_pack_start (GTK_BOX (group), priv->process_remove_space_toggle, FALSE,
                         FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (group), ProcessFieldsInsertSpace, FALSE,
+    gtk_box_pack_start (GTK_BOX (group), priv->process_insert_space_toggle, FALSE,
                         FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (group), ProcessFieldsOnlyOneSpace, FALSE,
+    gtk_box_pack_start (GTK_BOX (group), priv->process_insert_one_space_toggle, FALSE,
                         FALSE, 0);
     gtk_box_pack_start (GTK_BOX (group), radio_space_none, FALSE, FALSE, 0);
     /* Set check buttons to init value */
     if (PF_REMOVE_SPACE || PF_INSERT_SPACE || PF_ONLY_ONE_SPACE)
     {
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsRemoveSpace),PF_REMOVE_SPACE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsInsertSpace),PF_INSERT_SPACE);
-        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ProcessFieldsOnlyOneSpace),PF_ONLY_ONE_SPACE);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_remove_space_toggle),
+                                      PF_REMOVE_SPACE);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_insert_space_toggle),
+                                      PF_INSERT_SPACE);
+        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->process_insert_one_space_toggle),
+                                      PF_ONLY_ONE_SPACE);
     }
     else
     {
@@ -2278,25 +3048,25 @@ void Open_ScannerWindow (gint scanner_type)
                                       TRUE);
     }
     /* Tooltips */
-    gtk_widget_set_tooltip_text(ProcessFieldsRemoveSpace,
+    gtk_widget_set_tooltip_text(priv->process_remove_space_toggle,
         _("All spaces between words are removed. "
           "Example, before: 'Text In An Entry', after: 'TextInAnEntry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsInsertSpace,
+    gtk_widget_set_tooltip_text(priv->process_insert_space_toggle,
         _("A space is inserted before each upper case letter. "
           "Example, before: 'TextInAnEntry', after: 'Text In An Entry'."));
-    gtk_widget_set_tooltip_text(ProcessFieldsOnlyOneSpace,
+    gtk_widget_set_tooltip_text(priv->process_insert_one_space_toggle,
         _("Duplicate spaces and underscores are removed. "
           "Example, before: 'Text__In__An   Entry', after: 'Text_In_An Entry'."));
-    Select_Fields_Set_Sensitive();
+    Select_Fields_Set_Sensitive (self);
 
     /*
      * Frame to display codes legend
      */
-    LegendFrame = gtk_frame_new (_("Legend"));
-    gtk_box_pack_start(GTK_BOX(ScanVBox),LegendFrame,FALSE,FALSE,0);
+    priv->legend_frame = gtk_frame_new (_("Legend"));
+    gtk_box_pack_start(GTK_BOX(ScanVBox),priv->legend_frame,FALSE,FALSE,0);
     /* Legend labels */
     Table = et_grid_new (3, 6);
-    gtk_container_add(GTK_CONTAINER(LegendFrame),Table);
+    gtk_container_add(GTK_CONTAINER(priv->legend_frame),Table);
     gtk_container_set_border_width(GTK_CONTAINER(Table),4);
     Label = gtk_label_new(_("%a: artist"));
     et_grid_attach_margins (GTK_GRID (Table), Label, 0, 0, 1, 1, 6, 0);
@@ -2353,317 +3123,236 @@ void Open_ScannerWindow (gint scanner_type)
     /*
      * Masks Editor
      */
-    MaskEditorFrame = gtk_frame_new (_("Mask Editor"));
-    gtk_box_pack_start(GTK_BOX(ScanVBox),MaskEditorFrame,FALSE,FALSE,0);
-    MaskEditorHBox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,4);
-    gtk_container_add(GTK_CONTAINER(MaskEditorFrame),MaskEditorHBox);
-    gtk_container_set_border_width(GTK_CONTAINER(MaskEditorHBox), 4);
+    priv->mask_editor_frame = gtk_frame_new (_("Mask Editor"));
+    gtk_box_pack_start(GTK_BOX(ScanVBox),priv->mask_editor_frame,FALSE,FALSE,0);
+    mask_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BOX_SPACING);
+    gtk_container_add (GTK_CONTAINER (priv->mask_editor_frame), mask_hbox);
+    gtk_container_set_border_width (GTK_CONTAINER (mask_hbox), BOX_SPACING);
 
     /* The editor part */
-    MaskEditorVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL,2);
-    gtk_box_pack_start(GTK_BOX(MaskEditorHBox),MaskEditorVBox,TRUE,TRUE,0);
-    MaskEditorScrollWindow = gtk_scrolled_window_new(NULL,NULL);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorScrollWindow,TRUE,TRUE,0);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(MaskEditorScrollWindow),
+    vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,2);
+    gtk_box_pack_start(GTK_BOX(mask_hbox),vbox,TRUE,TRUE,0);
+    scrolled_window = gtk_scrolled_window_new(NULL,NULL);
+    gtk_box_pack_start(GTK_BOX(vbox),scrolled_window,TRUE,TRUE,0);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
                                    GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
-    gtk_widget_set_size_request(GTK_WIDGET(MaskEditorScrollWindow), -1, 101);
+    gtk_widget_set_size_request(GTK_WIDGET(scrolled_window), -1, 101);
 
     /* The list */
-    MaskEditorList = gtk_tree_view_new();
-    gtk_tree_view_set_model(GTK_TREE_VIEW(MaskEditorList), GTK_TREE_MODEL(ScanTagListModel));
+    priv->mask_editor_view = gtk_tree_view_new();
+    gtk_tree_view_set_model(GTK_TREE_VIEW(priv->mask_editor_view), 
GTK_TREE_MODEL(priv->scan_tag_masks_model));
 
     renderer = gtk_cell_renderer_text_new();
     column = gtk_tree_view_column_new_with_attributes(NULL,
             renderer, "text", MASK_EDITOR_TEXT, NULL);
-    gtk_tree_view_append_column(GTK_TREE_VIEW(MaskEditorList), column);
-    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(MaskEditorList), FALSE);
-    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList)),
+    gtk_tree_view_append_column(GTK_TREE_VIEW(priv->mask_editor_view), column);
+    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(priv->mask_editor_view), FALSE);
+    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(priv->mask_editor_view)),
                 GTK_SELECTION_MULTIPLE);
-    gtk_tree_view_set_reorderable(GTK_TREE_VIEW(MaskEditorList), TRUE);
-    gtk_container_add(GTK_CONTAINER(MaskEditorScrollWindow), MaskEditorList);
-    g_signal_connect_after(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList))),
-            "changed", G_CALLBACK(Mask_Editor_List_Row_Selected), NULL);
-    g_signal_connect(G_OBJECT(MaskEditorList), "key-press-event",
-        G_CALLBACK(Mask_Editor_List_Key_Press), NULL);
+    gtk_tree_view_set_reorderable(GTK_TREE_VIEW(priv->mask_editor_view), TRUE);
+    gtk_container_add(GTK_CONTAINER(scrolled_window), priv->mask_editor_view);
+    g_signal_connect_after (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->mask_editor_view)),
+                            "changed",
+                            G_CALLBACK (Mask_Editor_List_Row_Selected), self);
+    g_signal_connect (priv->mask_editor_view, "key-press-event",
+                      G_CALLBACK (Mask_Editor_List_Key_Press), self);
     /* The entry */
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),hbox,FALSE,FALSE,0);
-    MaskEditorEntry = gtk_entry_new();
-    gtk_box_pack_start(GTK_BOX(hbox),MaskEditorEntry,TRUE,TRUE,2);
-    g_signal_connect(G_OBJECT(MaskEditorEntry),"changed",
-        G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
+    gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,0);
+    priv->mask_editor_entry = gtk_entry_new();
+    gtk_box_pack_start(GTK_BOX(hbox),priv->mask_editor_entry,TRUE,TRUE,2);
+    g_signal_connect_swapped (priv->mask_editor_entry, "changed",
+                              G_CALLBACK (Mask_Editor_Entry_Changed), self);
     // Mask status icon
     // Signal connection to check if mask is correct into the mask entry
-    g_signal_connect (MaskEditorEntry,"changed",
+    g_signal_connect (priv->mask_editor_entry,"changed",
                       G_CALLBACK (entry_check_scan_tag_mask), NULL);
 
     /* The buttons part */
-    MaskEditorVBox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
-    gtk_box_pack_start(GTK_BOX(MaskEditorHBox),MaskEditorVBox,FALSE,FALSE,0);
+    vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+    gtk_box_pack_start (GTK_BOX (mask_hbox), vbox, FALSE, FALSE, 0);
 
     /* New mask button */
-    MaskEditorNewButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_NEW, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorNewButton),Icon);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorNewButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorNewButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorNewButton,_("Create New Mask"));
-    g_signal_connect(G_OBJECT(MaskEditorNewButton),"clicked",
-        G_CALLBACK(Mask_Editor_List_New),NULL);
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_start(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Create New Mask"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Mask_Editor_List_New), self);
 
     /* Move up mask button */
-    MaskEditorUpButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_GO_UP, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorUpButton),Icon);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorUpButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorUpButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorUpButton,_("Move Up this Mask"));
-    g_signal_connect(G_OBJECT(MaskEditorUpButton),"clicked",
-        G_CALLBACK(Mask_Editor_List_Move_Up),NULL);
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_start(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Move Up this Mask"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Mask_Editor_List_Move_Up), self);
 
     /* Move down mask button */
-    MaskEditorDownButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorDownButton),Icon);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorDownButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorDownButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorDownButton,_("Move Down this Mask"));
-    g_signal_connect(G_OBJECT(MaskEditorDownButton),"clicked",
-        G_CALLBACK(Mask_Editor_List_Move_Down),NULL);
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_start(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Move Down this Mask"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Mask_Editor_List_Move_Down), self);
 
     /* Copy mask button */
-    MaskEditorCopyButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorCopyButton),Icon);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorCopyButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorCopyButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorCopyButton,_("Duplicate Mask"));
-    g_signal_connect(G_OBJECT(MaskEditorCopyButton),"clicked",
-        G_CALLBACK(Mask_Editor_List_Duplicate),NULL);
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_start(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Duplicate Mask"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Mask_Editor_List_Duplicate), self);
 
     /* Add mask button */
-    MaskEditorAddButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorAddButton),Icon);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorAddButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorAddButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorAddButton,_("Add Default Masks"));
-    g_signal_connect(G_OBJECT(MaskEditorAddButton),"clicked",
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_start(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Add Default Masks"));
+    g_signal_connect(G_OBJECT(Button),"clicked",
         G_CALLBACK(Mask_Editor_List_Add),NULL);
 
     /* Remove mask button */
-    MaskEditorRemoveButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_REMOVE, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorRemoveButton),Icon);
-    gtk_box_pack_start(GTK_BOX(MaskEditorVBox),MaskEditorRemoveButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorRemoveButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorRemoveButton,_("Remove Mask"));
-    g_signal_connect(G_OBJECT(MaskEditorRemoveButton),"clicked",
-        G_CALLBACK(Mask_Editor_List_Remove),NULL);
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_start(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Remove Mask"));
+    g_signal_connect_swapped (Button, "clicked",
+                              G_CALLBACK (Mask_Editor_List_Remove), self);
 
     /* Save mask button */
-    MaskEditorSaveButton = gtk_button_new();
+    Button = gtk_button_new();
     Icon = gtk_image_new_from_stock(GTK_STOCK_SAVE, GTK_ICON_SIZE_SMALL_TOOLBAR);
-    gtk_container_add(GTK_CONTAINER(MaskEditorSaveButton),Icon);
-    gtk_box_pack_end(GTK_BOX(MaskEditorVBox),MaskEditorSaveButton,FALSE,FALSE,0);
-    gtk_button_set_relief(GTK_BUTTON(MaskEditorSaveButton),GTK_RELIEF_NONE);
-    gtk_widget_set_tooltip_text(MaskEditorSaveButton,_("Save Masks"));
-    g_signal_connect(G_OBJECT(MaskEditorSaveButton),"clicked",
+    gtk_container_add(GTK_CONTAINER(Button),Icon);
+    gtk_box_pack_end(GTK_BOX(vbox),Button,FALSE,FALSE,0);
+    gtk_button_set_relief(GTK_BUTTON(Button),GTK_RELIEF_NONE);
+    gtk_widget_set_tooltip_text(Button,_("Save Masks"));
+    g_signal_connect(G_OBJECT(Button),"clicked",
         G_CALLBACK(Mask_Editor_List_Save_Button),NULL);
 
-    gtk_widget_show(ScanVBox);
-    gtk_widget_show_all(HBox1);
-    gtk_widget_show_all(HBox2);
-    gtk_widget_show_all(HBox4);
-    gtk_widget_show(ScannerWindow);
-
-    /* Init position of the scanner window */
-    Scan_Set_Scanner_Window_Init_Position();
-
     /* To initialize the mask status icon and visibility */
-    g_signal_emit_by_name(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo)))),"changed");
-    g_signal_emit_by_name(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo)))),"changed");
-    g_signal_emit_by_name(G_OBJECT(MaskEditorEntry),"changed");
-    g_signal_emit_by_name(G_OBJECT(LegendButton),"toggled");        /* To hide legend frame */
-    g_signal_emit_by_name(G_OBJECT(MaskEditorButton),"toggled");    /* To hide mask editor frame */
-    g_signal_emit_by_name(G_OBJECT(ProcessFieldsConvert),"toggled");/* To enable / disable entries */
-    g_signal_emit_by_name(G_OBJECT(ProcessFieldsDetectRomanNumerals),"toggled");/* To enable / disable 
entries */
-
-    // Activate the current menu in the option menu
-    gtk_combo_box_set_active(GTK_COMBO_BOX(ScannerOptionCombo), scanner_type);
-
-    toggle_action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (UIManager,
-                                                                  "/ToolBar/ShowScanner"));
-    if (!gtk_toggle_action_get_active (toggle_action))
-    {
-        gtk_toggle_action_set_active (toggle_action, TRUE);
-    }
+    
g_signal_emit_by_name(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo)))),"changed");
+    
g_signal_emit_by_name(G_OBJECT(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->rename_file_mask_combo)))),"changed");
+    g_signal_emit_by_name (priv->mask_editor_entry, "changed");
+    g_signal_emit_by_name(G_OBJECT(priv->legend_toggle),"toggled");        /* To hide legend frame */
+    g_signal_emit_by_name(G_OBJECT(priv->mask_editor_toggle),"toggled");    /* To hide mask editor frame */
+    g_signal_emit_by_name(G_OBJECT(priv->process_convert_toggle),"toggled");/* To enable / disable entries */
+    g_signal_emit_by_name(G_OBJECT(priv->process_roman_numerals_check),"toggled");/* To enable / disable 
entries */
+
+    gtk_widget_show_all (ScanVBox);
+
+    /* Activate the current menu in the option menu. */
+    gtk_combo_box_set_active (GTK_COMBO_BOX (priv->type_combo),
+                              SCANNER_TYPE);
 }
 
 /*
  * Select the scanner to run for the current ETFile
  */
-void Scan_Select_Mode_And_Run_Scanner (ET_File *ETFile)
-{
-    g_return_if_fail (ScannerWindow != NULL || ETFile != NULL);
-
-    if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_FILL_TAG)
-    {
-        /* Run Scanner Type: Scan Tag */
-        Scan_Tag_With_Mask(ETFile);
-    } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_RENAME_FILE)
-    {
-        /* Run Scanner Type: Rename File */
-        Scan_Rename_File_With_Mask(ETFile);
-    } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_PROCESS_FIELDS)
-    {
-        /* Run Scanner Type: Process Fields */
-        Scan_Process_Fields(ETFile);
-    }
-}
-
-/*
- * et_scan_show:
- * @action: the #GtkToggleAction that was activated
- * @user_data: user data set when the signal handler was connected
- *
- * Show the scanner window.
- */
 void
-et_scan_show (GtkAction *action, gpointer user_data)
-{
-    gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-
-    if (active)
-    {
-        if (!ScannerWindow)
-        {
-            Open_ScannerWindow (SCANNER_TYPE);
-        }
-        else
-        {
-            gtk_window_present (GTK_WINDOW (ScannerWindow));
-        }
-    }
-    else
-    {
-        ScannerWindow_Quit ();
-    }
-}
-
-
-/* Callback from Open_ScannerWindow */
-static void
-ScannerWindow_Quit (void)
+Scan_Select_Mode_And_Run_Scanner (EtScanDialog *self, ET_File *ETFile)
 {
-    GtkToggleAction *toggle_action;
+    EtScanDialogPrivate *priv;
+    EtScanType mode;
 
-    toggle_action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (UIManager,
-                                                                  "/ToolBar/ShowScanner"));
+    g_return_if_fail (ET_SCAN_DIALOG (self));
+    g_return_if_fail (ETFile != NULL);
 
-    if (gtk_toggle_action_get_active (toggle_action))
-    {
-        gtk_toggle_action_set_active (toggle_action, FALSE);
-    }
+    priv = et_scan_dialog_get_instance_private (self);
+    mode = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->type_combo));
 
-    if (ScannerWindow)
+    switch (mode)
     {
-        ScannerWindow_Apply_Changes();
-
-        gtk_widget_destroy(ScannerWindow);
-        ScannerWindow     = NULL;
-        ScannerOptionCombo= NULL;
-
-        // To avoid crashs after tests
-        ScanTagMaskCombo              = NULL;
-        RenameFileMaskCombo           = NULL;
-        MaskEditorEntry               = NULL;
-        LegendFrame                   = NULL;
-        ProcessFieldsConvertIntoSpace = NULL;
-        ProcessFieldsConvertSpace     = NULL;
-        FillTagPreviewLabel           = NULL;
-        RenameFilePreviewLabel        = NULL;
+        case ET_SCAN_TYPE_FILL_TAG:
+            Scan_Tag_With_Mask (self, ETFile);
+            break;
+        case ET_SCAN_TYPE_RENAME_FILE:
+            Scan_Rename_File_With_Mask (self, ETFile);
+            break;
+        case ET_SCAN_TYPE_PROCESS_FIELDS:
+            Scan_Process_Fields (self, ETFile);
+            break;
+        default:
+            g_assert_not_reached ();
     }
 }
 
-
 /*
  * For the configuration file...
  */
-void ScannerWindow_Apply_Changes (void)
+void
+et_scan_dialog_apply_changes (EtScanDialog *self)
 {
-    if (ScannerWindow)
-    {
-        gint x, y;//, width, height;
-        GdkWindow *window;
-
-        window = gtk_widget_get_window(ScannerWindow);
-
-        if ( window && gdk_window_is_visible(window) && 
gdk_window_get_state(window)!=GDK_WINDOW_STATE_MAXIMIZED )
-        {
-            // Position and Origin of the scanner window
-            gdk_window_get_root_origin(window,&x,&y);
-            SCANNER_WINDOW_X = x;
-            SCANNER_WINDOW_Y = y;
-            //gdk_window_get_size(window,&width,&height);
-            //SCANNER_WINDOW_WIDTH  = width;
-            //SCANNER_WINDOW_HEIGHT = height;
-        }
-
-        // The scanner selected
-        SCANNER_TYPE = gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo));
-
-        SCAN_MASK_EDITOR_BUTTON   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(MaskEditorButton));
-        SCAN_LEGEND_BUTTON        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(LegendButton));
-
-        /* Group: select entries to process */
-        PROCESS_FILENAME_FIELD    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFileNameField));
-        PROCESS_TITLE_FIELD       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessTitleField));
-        PROCESS_ARTIST_FIELD      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessArtistField));
-        PROCESS_ALBUM_ARTIST_FIELD= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField));
-        PROCESS_ALBUM_FIELD       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumField));
-        PROCESS_GENRE_FIELD       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessGenreField));
-        PROCESS_COMMENT_FIELD     = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCommentField));
-        PROCESS_COMPOSER_FIELD    = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessComposerField));
-        PROCESS_ORIG_ARTIST_FIELD = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField));
-        PROCESS_COPYRIGHT_FIELD   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField));
-        PROCESS_URL_FIELD         = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessURLField));
-        PROCESS_ENCODED_BY_FIELD  = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField));
-
-        if (PROCESS_FIELDS_CONVERT_FROM) g_free(PROCESS_FIELDS_CONVERT_FROM);
-        PROCESS_FIELDS_CONVERT_FROM = g_strdup(gtk_entry_get_text(GTK_ENTRY(ProcessFieldsConvertFrom)));
-        if (PROCESS_FIELDS_CONVERT_TO) g_free(PROCESS_FIELDS_CONVERT_TO);
-        PROCESS_FIELDS_CONVERT_TO   = g_strdup(gtk_entry_get_text(GTK_ENTRY(ProcessFieldsConvertTo)));
-
-        /* Group: convert one character */
-        PF_CONVERT_INTO_SPACE     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvertIntoSpace));
-        PF_CONVERT_SPACE          = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvertSpace));
-        PF_CONVERT                = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvert));
-
-        /* Group: capitalize */
-        PF_CONVERT_ALL_UPPERCASE           = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsAllUppercase));
-        PF_CONVERT_ALL_DOWNCASE            = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsAllDowncase));
-        PF_CONVERT_FIRST_LETTER_UPPERCASE  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsFirstLetterUppercase));
-        PF_CONVERT_FIRST_LETTERS_UPPERCASE = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsFirstLettersUppercase));
-        PF_DETECT_ROMAN_NUMERALS           = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsDetectRomanNumerals));
-
-        /* Group: remove/insert space */
-        PF_REMOVE_SPACE   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsRemoveSpace));
-        PF_INSERT_SPACE   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsInsertSpace));
-        PF_ONLY_ONE_SPACE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsOnlyOneSpace));
-
-        // Save default masks...
-        if (SCAN_TAG_DEFAULT_MASK) g_free(SCAN_TAG_DEFAULT_MASK);
-        SCAN_TAG_DEFAULT_MASK = 
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(ScanTagMaskCombo)))));
-        Add_String_To_Combo_List(ScanTagListModel, SCAN_TAG_DEFAULT_MASK);
-        Save_Rename_File_Masks_List(ScanTagListModel, MASK_EDITOR_TEXT);
-
-        if (RENAME_FILE_DEFAULT_MASK) g_free(RENAME_FILE_DEFAULT_MASK);
-        RENAME_FILE_DEFAULT_MASK = 
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(RenameFileMaskCombo)))));
-        Add_String_To_Combo_List(RenameFileListModel, RENAME_FILE_DEFAULT_MASK);
-        Save_Rename_File_Masks_List(RenameFileListModel, MASK_EDITOR_TEXT);
-
-    }
+    EtScanDialogPrivate *priv;
+
+    g_return_if_fail (ET_SCAN_DIALOG (self));
+
+    priv = et_scan_dialog_get_instance_private (self);
+
+    /* The selected scanner type. */
+    SCANNER_TYPE = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->type_combo));
+
+    SCAN_MASK_EDITOR_BUTTON   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->mask_editor_toggle));
+    SCAN_LEGEND_BUTTON        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->legend_toggle));
+
+    /* Group: select entries to process */
+    PROCESS_FILENAME_FIELD    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_filename_toggle));
+    PROCESS_TITLE_FIELD       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_title_toggle));
+    PROCESS_ARTIST_FIELD      = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_artist_toggle));
+    PROCESS_ALBUM_ARTIST_FIELD= 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_artist_toggle));
+    PROCESS_ALBUM_FIELD       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_album_toggle));
+    PROCESS_GENRE_FIELD       = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_genre_toggle));
+    PROCESS_COMMENT_FIELD     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_comment_toggle));
+    PROCESS_COMPOSER_FIELD    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_composer_toggle));
+    PROCESS_ORIG_ARTIST_FIELD = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_original_artist_toggle));
+    PROCESS_COPYRIGHT_FIELD   = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_copyright_toggle));
+    PROCESS_URL_FIELD         = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_url_toggle));
+    PROCESS_ENCODED_BY_FIELD  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_encoded_by_toggle));
+
+    if (PROCESS_FIELDS_CONVERT_FROM) g_free(PROCESS_FIELDS_CONVERT_FROM);
+    PROCESS_FIELDS_CONVERT_FROM = g_strdup(gtk_entry_get_text(GTK_ENTRY(priv->process_convert_from_entry)));
+    if (PROCESS_FIELDS_CONVERT_TO) g_free(PROCESS_FIELDS_CONVERT_TO);
+    PROCESS_FIELDS_CONVERT_TO   = g_strdup(gtk_entry_get_text(GTK_ENTRY(priv->process_convert_to_entry)));
+
+    /* Group: convert one character */
+    PF_CONVERT_INTO_SPACE     = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_space_toggle));
+    PF_CONVERT_SPACE          = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_to_underscores_toggle));
+    PF_CONVERT                = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_convert_toggle));
+
+    /* Group: capitalize */
+    PF_CONVERT_ALL_UPPERCASE           = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_all_uppercase_toggle));
+    PF_CONVERT_ALL_DOWNCASE            = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_all_lowercase_toggle));
+    PF_CONVERT_FIRST_LETTER_UPPERCASE  = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_first_uppercase_toggle));
+    PF_CONVERT_FIRST_LETTERS_UPPERCASE = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_first_style_uppercase_toggle));
+    PF_DETECT_ROMAN_NUMERALS           = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_roman_numerals_check));
+
+    /* Group: remove/insert space */
+    PF_REMOVE_SPACE   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_remove_space_toggle));
+    PF_INSERT_SPACE   = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_insert_space_toggle));
+    PF_ONLY_ONE_SPACE = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->process_insert_one_space_toggle));
+
+    /* Save default masks. */
+    if (SCAN_TAG_DEFAULT_MASK) g_free(SCAN_TAG_DEFAULT_MASK);
+    SCAN_TAG_DEFAULT_MASK = 
g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(priv->scan_tag_mask_combo)))));
+    Add_String_To_Combo_List(priv->scan_tag_masks_model, SCAN_TAG_DEFAULT_MASK);
+    Save_Rename_File_Masks_List(priv->scan_tag_masks_model, MASK_EDITOR_TEXT);
+
+    if (RENAME_FILE_DEFAULT_MASK) g_free(RENAME_FILE_DEFAULT_MASK);
+    RENAME_FILE_DEFAULT_MASK = g_strdup (gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN 
(priv->rename_file_mask_combo)))));
+    Add_String_To_Combo_List(priv->rename_masks_model, RENAME_FILE_DEFAULT_MASK);
+    Save_Rename_File_Masks_List(priv->rename_masks_model, MASK_EDITOR_TEXT);
 }
 
 
@@ -2671,8 +3360,8 @@ void ScannerWindow_Apply_Changes (void)
 static void
 Scan_Option_Button (void)
 {
-    Open_OptionsWindow();
-    gtk_notebook_set_current_page(GTK_NOTEBOOK(OptionsNoteBook), OptionsNoteBook_Scanner_Page_Num);
+    et_application_window_show_preferences_dialog_scanner (NULL,
+                                                           ET_APPLICATION_WINDOW (MainWindow));
 }
 
 
@@ -2815,734 +3504,131 @@ entry_check_rename_file_mask (GtkEntry *entry, gpointer user_data)
                                            NULL);
 }
 
-
-static void
-Scan_Toggle_Legend_Button (void)
-{
-    g_return_if_fail (LegendButton != NULL || LegendFrame != NULL);
-
-    if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(LegendButton)) )
-        gtk_widget_show_all(LegendFrame);
-    else
-        gtk_widget_hide(LegendFrame);
-}
-
-
-static void
-Scan_Toggle_Mask_Editor_Button (void)
-{
-    GtkTreeModel *treemodel;
-    GtkTreeSelection *selection;
-    GtkTreeIter iter;
-
-    g_return_if_fail (MaskEditorButton != NULL || MaskEditorFrame != NULL ||
-                      MaskEditorList != NULL);
-
-    if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(MaskEditorButton)) )
-    {
-        gtk_widget_show_all(MaskEditorFrame);
-
-        // Select first row in list
-        treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-        if (gtk_tree_model_get_iter_first(treemodel, &iter))
-        {
-            selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-            gtk_tree_selection_unselect_all(selection);
-            gtk_tree_selection_select_iter(selection, &iter);
-        }
-
-        // Update status of the icon box cause prev instruction show it for all cases
-        g_signal_emit_by_name(G_OBJECT(MaskEditorEntry),"changed");
-    }else
-    {
-        gtk_widget_hide(MaskEditorFrame);
-    }
-}
-
-
-
-static void
-Process_Fields_Convert_Check_Button_Toggled (GtkWidget *object)
-{
-    
gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertTo),gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)));
-    
gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertFrom),gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)));
-}
-
-static void
-Process_Fields_First_Letters_Check_Button_Toggled (GtkWidget *object)
-{
-    
gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsDetectRomanNumerals),gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object)));
-}
-
-
-/*
- * Small buttons of Process Fields scanner
- */
-static void
-Select_Fields_Invert_Selection (void)
-{
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessFileNameField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFileNameField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessTitleField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessTitleField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessArtistField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessArtistField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessAlbumField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessGenreField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessGenreField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessCommentField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCommentField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessComposerField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessComposerField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessURLField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessURLField)));
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField),
-                                !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField)));
-}
-
-static void
-Select_Fields_Select_Unselect_All (void)
-{
-    static gboolean state = TRUE;
-
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessFileNameField),   state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessTitleField),      state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessArtistField),     state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField),state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessAlbumField),      state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessGenreField),      state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessCommentField),    state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessComposerField),   state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField), state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField),  state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessURLField),        state);
-    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField),  state);
-    state = !state;
-}
-
-/*
- * Set sensitive state of the processing check boxes : if no one is selected => all disabled
- */
-static void
-Select_Fields_Set_Sensitive (void)
-{
-    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFileNameField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessTitleField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessArtistField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumArtistField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessAlbumField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessGenreField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCommentField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessComposerField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessOrigArtistField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessCopyrightField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessURLField))
-    ||  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessEncodedByField)))
-    {
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertIntoSpace),     TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertSpace),         TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvert),              TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertLabelTo),       TRUE);
-        // Activate the two entries only if the check box is activated, else keep them disabled
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ProcessFieldsConvert)))
-        {
-            gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertTo),        TRUE);
-            gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertFrom),      TRUE);
-        }
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsAllUppercase),         TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsAllDowncase),          TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsFirstLetterUppercase), TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsFirstLettersUppercase),TRUE);
-        Process_Fields_First_Letters_Check_Button_Toggled (ProcessFieldsFirstLettersUppercase);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsRemoveSpace),          TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsInsertSpace),          TRUE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsOnlyOneSpace),         TRUE);
-    }else
-    {
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertIntoSpace),     FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertSpace),         FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvert),              FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertTo),            FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertLabelTo),       FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsConvertFrom),          FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsAllUppercase),         FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsAllDowncase),          FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsFirstLetterUppercase), FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsFirstLettersUppercase),FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsDetectRomanNumerals),  FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsRemoveSpace),          FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsInsertSpace),          FALSE);
-        gtk_widget_set_sensitive(GTK_WIDGET(ProcessFieldsOnlyOneSpace),         FALSE);
-    }
-}
-
-/*
- * Callbacks from Mask Editor buttons
- */
-
-/*
- * Callback from the mask edit list
- * Previously known as Mask_Editor_List_Select_Row
- */
-static void
-Mask_Editor_List_Row_Selected (GtkTreeSelection* selection, gpointer data)
-{
-    GList *selectedRows;
-    gchar *text = NULL;
-    GtkTreePath *lastSelected;
-    GtkTreeIter lastFile;
-    GtkTreeModel *treemodel;
-    gboolean valid;
-
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-
-    /* We must block the function, else the previous selected row will be modified */
-    g_signal_handlers_block_by_func(G_OBJECT(MaskEditorEntry),
-                                    G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
-
-    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
-
-    /*
-     * At some point, we might get called when no rows are selected?
-     */
-    if (!selectedRows)
-    {
-        g_signal_handlers_unblock_by_func(G_OBJECT(MaskEditorEntry),
-                                          G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
-        return;
-    }
-
-    /* Get the text of the last selected row */
-    lastSelected = (GtkTreePath *)g_list_last(selectedRows)->data;
-
-    valid= gtk_tree_model_get_iter(treemodel, &lastFile, lastSelected);
-    if (valid)
-    {
-        gtk_tree_model_get(treemodel, &lastFile, MASK_EDITOR_TEXT, &text, -1);
-
-        if (text)
-        {
-            gtk_entry_set_text(GTK_ENTRY(MaskEditorEntry),text);
-            g_free(text);
-        }
-    }
-
-    g_signal_handlers_unblock_by_func(G_OBJECT(MaskEditorEntry),
-                                      G_CALLBACK(Mask_Editor_Entry_Changed),NULL);
-
-    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
-}
-
-
-/*
- * Add a new mask to the list
- */
-static void
-Mask_Editor_List_New (void)
-{
-    gchar *text = _("New_mask");
-    GtkTreeIter iter;
-    GtkTreeSelection *selection;
-    GtkTreeModel *treemodel;
-
-    g_return_if_fail (MaskEditorList != NULL);
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-
-    gtk_list_store_insert(GTK_LIST_STORE(treemodel), &iter, 0);
-    gtk_list_store_set(GTK_LIST_STORE(treemodel), &iter, MASK_EDITOR_TEXT, text, -1);
-
-    gtk_tree_selection_unselect_all(selection);
-    gtk_tree_selection_select_iter(selection, &iter);
-}
-
-/*
- * Duplicate a mask on the list
- */
-static void
-Mask_Editor_List_Duplicate (void)
+void
+et_scan_dialog_scan_selected_files (EtScanDialog *self)
 {
-    gchar *text = NULL;
-    GList *selectedRows;
+    gint progress_bar_index;
+    gint selectcount;
+    gchar progress_bar_text[30];
+    double fraction;
+    GList *selfilelist = NULL;
     GList *l;
-    GList *toInsert = NULL;
+    ET_File *etfile;
     GtkTreeSelection *selection;
-    GtkTreeIter rowIter;
-    GtkTreeModel *treeModel;
-
-    g_return_if_fail (MaskEditorList != NULL);
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
-    treeModel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-
-    if (!selectedRows)
-    {
-        Log_Print(LOG_ERROR,_("Copy: No row selected"));
-        return;
-    }
-
-    /* Loop through selected rows, duplicating them into a GList
-     * We cannot directly insert because the paths in selectedRows
-     * get out of date after an insertion */
-    for (l = selectedRows; l != NULL; l = g_list_next (l))
-    {
-        if (gtk_tree_model_get_iter (treeModel, &rowIter,
-                                     (GtkTreePath*)l->data))
-        {
-            gtk_tree_model_get(treeModel, &rowIter, MASK_EDITOR_TEXT, &text, -1);
-            toInsert = g_list_prepend (toInsert, text);
-        }
-    }
-
-    for (l = toInsert; l != NULL; l = g_list_next (l))
-    {
-        gtk_list_store_insert_with_values (GTK_LIST_STORE(treeModel), &rowIter,
-                                           0, MASK_EDITOR_TEXT,
-                                           (gchar *)l->data, -1);
-    }
 
-    // Set focus to the last inserted line
-    if (toInsert)
-        Mask_Editor_List_Set_Row_Visible(treeModel,&rowIter);
-
-    /* Free data no longer needed */
-    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
-    g_list_free_full (toInsert, (GDestroyNotify)g_free);
-}
-
-static void
-Mask_Editor_List_Add (void)
-{
-    gint i = 0;
-    GtkTreeModel *treemodel;
-    gchar *temp;
-
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-
-    if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_FILL_TAG)
-    {
-        while(Scan_Masks[i])
-        {
-            /*if (!g_utf8_validate(Scan_Masks[i], -1, NULL))
-                temp = convert_to_utf8(Scan_Masks[i]);
-            else
-                temp = g_strdup(Scan_Masks[i]);*/
-            temp = Try_To_Validate_Utf8_String(Scan_Masks[i]);
-
-            gtk_list_store_insert_with_values (GTK_LIST_STORE (treemodel),
-                                               NULL, G_MAXINT,
-                                               MASK_EDITOR_TEXT, temp, -1);
-            g_free(temp);
-            i++;
-        }
-    } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_RENAME_FILE)
-    {
-        while(Rename_File_Masks[i])
-        {
-            /*if (!g_utf8_validate(Rename_File_Masks[i], -1, NULL))
-                temp = convert_to_utf8(Rename_File_Masks[i]);
-            else
-                temp = g_strdup(Rename_File_Masks[i]);*/
-            temp = Try_To_Validate_Utf8_String(Rename_File_Masks[i]);
-
-            gtk_list_store_insert_with_values (GTK_LIST_STORE (treemodel),
-                                               NULL, G_MAXINT,
-                                               MASK_EDITOR_TEXT, temp, -1);
-            g_free(temp);
-            i++;
-        }
-    }
-}
+    g_return_if_fail (ETCore->ETFileDisplayedList != NULL ||
+                      BrowserList != NULL);
 
-/*
- * Remove the selected rows from the mask editor list
- */
-static void
-Mask_Editor_List_Remove (void)
-{
-    GtkTreeSelection *selection;
-    GtkTreeIter iter;
-    GtkTreeModel *treemodel;
+    /* Save the current displayed data */
+    ET_Save_File_Data_From_UI(ETCore->ETFileDisplayed);
 
-    g_return_if_fail (MaskEditorList != NULL);
+    /* Initialize status bar */
+    selectcount = 
gtk_tree_selection_count_selected_rows(gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList)));
+    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar),0);
+    progress_bar_index = 0;
+    g_snprintf(progress_bar_text, 30, "%d/%d", progress_bar_index, selectcount);
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
 
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
+    /* Set to unsensitive all command buttons (except Quit button) */
+    Disable_Command_Buttons();
 
-    if (gtk_tree_selection_count_selected_rows(selection) == 0) {
-        Log_Print(LOG_ERROR,_("Remove: No row selected"));
-        return;
-    }
+    progress_bar_index = 0;
 
-    if (!gtk_tree_model_get_iter_first(treemodel, &iter))
-        return;
+    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(BrowserList));
+    selfilelist = gtk_tree_selection_get_selected_rows(selection, NULL);
 
-    while (TRUE)
+    for (l = selfilelist; l != NULL; l = g_list_next (l))
     {
-        if (gtk_tree_selection_iter_is_selected(selection, &iter))
-        {
-            if (!gtk_list_store_remove(GTK_LIST_STORE(treemodel), &iter))
-            {
-                break;
-            }
-        } else
-        {
-            if (!gtk_tree_model_iter_next(treemodel, &iter))
-            {
-                break;
-            }
-        }
-    }
-}
-
-/*
- * Move all selected rows up one place in the mask list
- */
-static void
-Mask_Editor_List_Move_Up (void)
-{
-    GtkTreeSelection *selection;
-    GList *selectedRows;
-    GList *l;
-    GtkTreeIter currentFile;
-    GtkTreeIter nextFile;
-    GtkTreePath *currentPath;
-    GtkTreeModel *treemodel;
-
-    g_return_if_fail (MaskEditorList != NULL);
+        etfile = Browser_List_Get_ETFile_From_Path (l->data);
 
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+        /* Run the current scanner. */
+        Scan_Select_Mode_And_Run_Scanner (self, etfile);
 
-    if (!selectedRows)
-    {
-        Log_Print(LOG_ERROR,_("Move Up: No row selected"));
-        return;
-    }
+        fraction = (++progress_bar_index) / (double) selectcount;
+        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), fraction);
+        g_snprintf(progress_bar_text, 30, "%d/%d", progress_bar_index, selectcount);
+        gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), progress_bar_text);
 
-    for (l = selectedRows; l != NULL; l = g_list_next (l))
-    {
-        currentPath = (GtkTreePath *)l->data;
-        if (gtk_tree_model_get_iter(treemodel, &currentFile, currentPath))
-        {
-            /* Find the entry above the node... */
-            if (gtk_tree_path_prev(currentPath))
-            {
-                /* ...and if it exists, swap the two rows by iter */
-                gtk_tree_model_get_iter(treemodel, &nextFile, currentPath);
-                gtk_list_store_swap(GTK_LIST_STORE(treemodel), &currentFile, &nextFile);
-            }
-        }
+        /* Needed to refresh status bar */
+        while (gtk_events_pending())
+            gtk_main_iteration();
     }
 
-    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
-}
-
-/*
- * Move all selected rows down one place in the mask list
- */
-static void
-Mask_Editor_List_Move_Down (void)
-{
-    GtkTreeSelection *selection;
-    GList *selectedRows;
-    GList *l;
-    GtkTreeIter currentFile;
-    GtkTreeIter nextFile;
-    GtkTreePath *currentPath;
-    GtkTreeModel *treemodel;
-
-    g_return_if_fail (MaskEditorList != NULL);
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
+    g_list_free_full (selfilelist, (GDestroyNotify)gtk_tree_path_free);
 
-    if (!selectedRows)
-    {
-        Log_Print(LOG_ERROR,_("Move Down: No row selected"));
-        return;
-    }
+    // Refresh the whole list (faster than file by file) to show changes
+    Browser_List_Refresh_Whole_List();
 
-    for (l = selectedRows; l != NULL; l = g_list_next (l))
-    {
-        currentPath = (GtkTreePath *)l->data;
+    /* Display the current file */
+    ET_Display_File_Data_To_UI(ETCore->ETFileDisplayed);
 
-        if (gtk_tree_model_get_iter(treemodel, &currentFile, currentPath))
-        {
-            /* Find the entry below the node and swap the two nodes by iter */
-            gtk_tree_path_next(currentPath);
-            if (gtk_tree_model_get_iter(treemodel, &nextFile, currentPath))
-                gtk_list_store_swap(GTK_LIST_STORE(treemodel), &currentFile, &nextFile);
-        }
-    }
+    /* To update state of command buttons */
+    Update_Command_Buttons_Sensivity();
 
-    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
+    gtk_progress_bar_set_text(GTK_PROGRESS_BAR(ProgressBar), "");
+    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(ProgressBar), 0);
+    Statusbar_Message(_("All tags have been scanned"),TRUE);
 }
 
 /*
- * Set a row visible in the mask editor list (by scrolling the list)
- */
-static void
-Mask_Editor_List_Set_Row_Visible (GtkTreeModel *treeModel, GtkTreeIter *rowIter)
-{
-    /*
-     * TODO: Make this only scroll to the row if it is not visible
-     * (like in easytag GTK1)
-     * See function gtk_tree_view_get_visible_rect() ??
-     */
-    GtkTreePath *rowPath;
-
-    g_return_if_fail (treeModel != NULL);
-
-    rowPath = gtk_tree_model_get_path(treeModel, rowIter);
-    gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(MaskEditorList), rowPath, NULL, FALSE, 0, 0);
-    gtk_tree_path_free(rowPath);
-}
-
-/*
- * Save the currently displayed mask list in the mask editor
+ * et_scan_on_response:
+ * @dialog: the scanner window
+ * @response_id: the #GtkResponseType corresponding to the dialog event
+ * @user_data: user data set when the signal was connected
+ *
+ * Handle the response signal of the scanner dialog.
  */
 static void
-Mask_Editor_List_Save_Button (void)
+et_scan_on_response (GtkDialog *dialog, gint response_id, gpointer user_data)
 {
-    Mask_Editor_Clean_Up_Masks_List();
-
-    if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_FILL_TAG)
-    {
-        Save_Scan_Tag_Masks_List(ScanTagListModel, MASK_EDITOR_TEXT);
-    } else if (gtk_combo_box_get_active(GTK_COMBO_BOX(ScannerOptionCombo)) == SCANNER_RENAME_FILE)
+    switch (response_id)
     {
-        Save_Rename_File_Masks_List(RenameFileListModel, MASK_EDITOR_TEXT);
+        case GTK_RESPONSE_APPLY:
+            et_scan_dialog_scan_selected_files (ET_SCAN_DIALOG (dialog));
+            break;
+        case GTK_RESPONSE_CLOSE:
+            gtk_widget_hide (GTK_WIDGET (dialog));
+            break;
+        case GTK_RESPONSE_DELETE_EVENT:
+            break;
+        default:
+            g_assert_not_reached ();
+            break;
     }
 }
 
-/*
- * Clean up the currently displayed masks lists, ready for saving
- */
 static void
-Mask_Editor_Clean_Up_Masks_List (void)
+et_scan_dialog_finalize (GObject *object)
 {
-    gchar *text = NULL;
-    gchar *text1 = NULL;
-    GtkTreeIter currentIter;
-    GtkTreeIter itercopy;
-    GtkTreeModel *treemodel;
-
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-
-    /* Remove blank and duplicate items */
-    if (gtk_tree_model_get_iter_first(treemodel, &currentIter))
-    {
-
-        while(TRUE)
-        {
-            gtk_tree_model_get(treemodel, &currentIter, MASK_EDITOR_TEXT, &text, -1);
-
-            /* Check for blank entry */
-            if (text && g_utf8_strlen(text, -1) == 0)
-            {
-                g_free(text);
-
-                if (!gtk_list_store_remove(GTK_LIST_STORE(treemodel), &currentIter))
-                    break; /* No following entries */
-                else
-                    continue; /* Go on to next entry, which the remove function already moved onto for us */
-            }
-
-            /* Check for duplicate entries */
-            itercopy = currentIter;
-            if (!gtk_tree_model_iter_next(treemodel, &itercopy))
-            {
-                g_free(text);
-                break;
-            }
-
-            while(TRUE)
-            {
-                gtk_tree_model_get(treemodel, &itercopy, MASK_EDITOR_TEXT, &text1, -1);
-                if (text1 && g_utf8_collate(text,text1) == 0)
-                {
-                    g_free(text1);
-
-                    if (!gtk_list_store_remove(GTK_LIST_STORE(treemodel), &itercopy))
-                        break; /* No following entries */
-                    else
-                        continue; /* Go on to next entry, which the remove function already set iter to for 
us */
-
-                }
-                g_free(text1);
-                if (!gtk_tree_model_iter_next(treemodel, &itercopy))
-                    break;
-            }
-
-            g_free(text);
-
-            if (!gtk_tree_model_iter_next(treemodel, &currentIter))
-                break;
-        }
-    }
+    G_OBJECT_CLASS (et_scan_dialog_parent_class)->finalize (object);
 }
 
-/*
- * Update the Mask List with the new value of the entry box
- */
 static void
-Mask_Editor_Entry_Changed (void)
+et_scan_dialog_init (EtScanDialog *self)
 {
-    GtkTreeSelection *selection;
-    GtkTreePath *firstSelected;
-    GtkTreeModel *treemodel;
-    GList *selectedRows;
-    GtkTreeIter row;
-    const gchar* text;
-
-    g_return_if_fail (MaskEditorList != NULL);
-
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(MaskEditorList));
-    treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(MaskEditorList));
-    selectedRows = gtk_tree_selection_get_selected_rows(selection, NULL);
-
-    if (!selectedRows)
-    {
-        return;
-    }
-
-    firstSelected = (GtkTreePath *)g_list_first(selectedRows)->data;
-    text = gtk_entry_get_text(GTK_ENTRY(MaskEditorEntry));
-
-    if (gtk_tree_model_get_iter (treemodel, &row, firstSelected))
-    {
-        gtk_list_store_set(GTK_LIST_STORE(treemodel), &row, MASK_EDITOR_TEXT, text, -1);
-    }
+    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ET_TYPE_SCAN_DIALOG,
+                                              EtScanDialogPrivate);
 
-    g_list_free_full (selectedRows, (GDestroyNotify)gtk_tree_path_free);
+    create_scan_dialog (self);
 }
 
-/*
- * Actions when the a key is pressed into the masks editor clist
- */
-static gboolean
-Mask_Editor_List_Key_Press (GtkWidget *widget, GdkEvent *event)
-{
-    if (event && event->type == GDK_KEY_PRESS) {
-        GdkEventKey *kevent = (GdkEventKey *)event;
-
-        switch(kevent->keyval)
-        {
-            case GDK_KEY_Delete:
-                Mask_Editor_List_Remove();
-                break;
-/*          case GDK_KEY_Up:
-                Mask_Editor_Clist_Move_Up();
-                break;
-            case GDK_KEY_Down:
-                Mask_Editor_Clist_Move_Down();
-                break;
-*/      }
-    }
-    return TRUE;
-}
-
-/*
- * Function when you select an item of the option menu
- */
 static void
-Scanner_Option_Menu_Activate_Item (GtkWidget *combo, gpointer data)
+et_scan_dialog_class_init (EtScanDialogClass *klass)
 {
-    GtkRadioAction *radio_action;
-
-    radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (UIManager,
-                                                                "/MenuBar/ViewMenu/ScannerMenu/FillTag"));
-    SCANNER_TYPE = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
-    gtk_radio_action_set_current_value (radio_action, SCANNER_TYPE);
-
-    switch (SCANNER_TYPE)
-    {
-        case SCANNER_FILL_TAG:
-            gtk_widget_show(MaskEditorButton);
-            gtk_widget_show(LegendButton);
-            gtk_widget_show(ScanTagFrame);
-            gtk_widget_hide(RenameFileFrame);
-            gtk_widget_hide(ProcessFieldsFrame);
-            gtk_tree_view_set_model(GTK_TREE_VIEW(MaskEditorList), GTK_TREE_MODEL(ScanTagListModel));
-            Scan_Fill_Tag_Generate_Preview();
-            g_signal_emit_by_name(G_OBJECT(LegendButton),"toggled");        /* To hide or show legend frame 
*/
-            g_signal_emit_by_name(G_OBJECT(MaskEditorButton),"toggled");    /* To hide or show mask editor 
frame */
-            break;
-
-        case SCANNER_RENAME_FILE:
-            gtk_widget_show(MaskEditorButton);
-            gtk_widget_show(LegendButton);
-            gtk_widget_hide(ScanTagFrame);
-            gtk_widget_show(RenameFileFrame);
-            gtk_widget_hide(ProcessFieldsFrame);
-            gtk_tree_view_set_model(GTK_TREE_VIEW(MaskEditorList), GTK_TREE_MODEL(RenameFileListModel));
-            Scan_Rename_File_Generate_Preview();
-            g_signal_emit_by_name(G_OBJECT(LegendButton),"toggled");        /* To hide or show legend frame 
*/
-            g_signal_emit_by_name(G_OBJECT(MaskEditorButton),"toggled");    /* To hide or show mask editor 
frame */
-            break;
-
-        case SCANNER_PROCESS_FIELDS:
-            gtk_widget_hide(MaskEditorButton);
-            gtk_widget_hide(LegendButton);
-            gtk_widget_hide(ScanTagFrame);
-            gtk_widget_hide(RenameFileFrame);
-            gtk_widget_show_all(ProcessFieldsFrame);
-            // Hide directly the frames to don't change state of the buttons!
-            gtk_widget_hide(LegendFrame);
-            gtk_widget_hide(MaskEditorFrame);
+    G_OBJECT_CLASS (klass)->finalize = et_scan_dialog_finalize;
 
-            gtk_tree_view_set_model(GTK_TREE_VIEW(MaskEditorList), NULL);
-            break;
-    }
+    g_type_class_add_private (klass, sizeof (EtScanDialogPrivate));
 }
 
 /*
- * Init the position of the scanner window
- */
-static void
-Scan_Set_Scanner_Window_Init_Position (void)
-{
-    if (ScannerWindow && SET_SCANNER_WINDOW_POSITION)
-    {
-        gtk_widget_realize(ScannerWindow);
-        gtk_window_move(GTK_WINDOW(ScannerWindow),SCANNER_WINDOW_X,SCANNER_WINDOW_Y);
-    }
-}
-
-/*
- * et_scan_on_response:
- * @dialog: the scanner window
- * @response_id: the #GtkResponseType corresponding to the dialog event
- * @user_data: user data set when the signal was connected
+ * et_scan_dialog_new:
  *
- * Handle the response signal of the scanner dialog.
+ * Create a new EtScanDialog instance.
+ *
+ * Returns: a new #EtScanDialog
  */
-static void
-et_scan_on_response (GtkDialog *dialog, gint response_id, gpointer user_data)
+EtScanDialog *
+et_scan_dialog_new (void)
 {
-    switch (response_id)
-    {
-        case GTK_RESPONSE_APPLY:
-            Action_Scan_Selected_Files ();
-            break;
-        case GTK_RESPONSE_DELETE_EVENT:
-        case GTK_RESPONSE_CLOSE:
-            ScannerWindow_Quit ();
-            break;
-        default:
-            g_assert_not_reached ();
-            break;
-    }
+    return g_object_new (ET_TYPE_SCAN_DIALOG, NULL);
 }
diff --git a/src/scan_dialog.h b/src/scan_dialog.h
index 83ec928..626b91c 100644
--- a/src/scan_dialog.h
+++ b/src/scan_dialog.h
@@ -1,4 +1,3 @@
-/* scan.h - 2000/06/16 */
 /*
  *  EasyTAG - Tag editor for MP3 and Ogg Vorbis files
  *  Copyright (C) 2000-2003  Jerome Couderc <easytag gmail com>
@@ -19,51 +18,67 @@
  */
 
 
-#ifndef __SCAN_H__
-#define __SCAN_H__
-
+#ifndef ET_SCAN_DIALOG_H_
+#define ET_SCAN_DIALOG_H_
 
 #include "et_core.h"
 
-/****************
- * Declarations *
- ****************/
-GtkWidget *ScannerWindow;
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define ET_TYPE_SCAN_DIALOG (et_scan_dialog_get_type ())
+#define ET_SCAN_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), ET_TYPE_SCAN_DIALOG, EtScanDialog))
 
+typedef struct _EtScanDialog EtScanDialog;
+typedef struct _EtScanDialogClass EtScanDialogClass;
+typedef struct _EtScanDialogPrivate EtScanDialogPrivate;
 
-enum
+struct _EtScanDialog
 {
-    SCANNER_FILL_TAG = 0,
-    SCANNER_RENAME_FILE,
-    SCANNER_PROCESS_FIELDS
-}; // Add a new item : Min and Max values used in Open_ScannerWindow
+    /*< private >*/
+    GtkDialog parent_instance;
+    EtScanDialogPrivate *priv;
+};
 
-enum {
-    MASK_EDITOR_TEXT,
-    MASK_EDITOR_COUNT
+struct _EtScanDialogClass
+{
+    /*< private >*/
+    GtkDialogClass parent_class;
 };
 
+/*
+ * The mode for the scanner window.
+ */
+typedef enum
+{
+    ET_SCAN_TYPE_FILL_TAG,
+    ET_SCAN_TYPE_RENAME_FILE,
+    ET_SCAN_TYPE_PROCESS_FIELDS
+} EtScanType;
+
+GType et_scan_dialog_get_type (void);
+EtScanDialog *et_scan_dialog_new (void);
+void et_scan_dialog_apply_changes (EtScanDialog *self);
+void et_scan_dialog_open (EtScanDialog *self, EtScanType scanner_type);
+void et_scan_dialog_scan_selected_files (EtScanDialog *self);
+void et_scan_dialog_update_previews (EtScanDialog *self);
 
+G_END_DECLS
 
-/**************
- * Prototypes *
- **************/
 
-void   Scan_Select_Mode_And_Run_Scanner     (ET_File *ETFile);
+enum {
+    MASK_EDITOR_TEXT,
+    MASK_EDITOR_COUNT
+};
+
+void Scan_Select_Mode_And_Run_Scanner (EtScanDialog *self, ET_File *ETFile);
 gchar *Scan_Generate_New_Filename_From_Mask       (ET_File *ETFile, gchar *mask, gboolean 
no_dir_check_or_conversion);
 gchar *Scan_Generate_New_Directory_Name_From_Mask (ET_File *ETFile, gchar *mask, gboolean 
no_dir_check_or_conversion);
-void   Scan_Rename_File_Generate_Preview      (void);
-void   Scan_Fill_Tag_Generate_Preview         (void);
 void   Scan_Rename_Directory_Generate_Preview (void);
 
-void et_scan_show (GtkAction *action, gpointer user_data);
-
 void entry_check_rename_file_mask (GtkEntry *entry, gpointer user_data);
 
-void Scan_Process_Fields_First_Letters_Uppercase (gchar **str);
-
-void Init_ScannerWindow (void);
-void Open_ScannerWindow (gint scanner_type);
-void ScannerWindow_Apply_Changes (void);
+void Scan_Process_Fields_First_Letters_Uppercase (EtScanDialog *self, gchar **str);
 
-#endif /* __SCAN_H__ */
+#endif /* ET_SCAN_DIALOG_H_ */
diff --git a/src/search_dialog.c b/src/search_dialog.c
index 49b5975..5bc55c6 100644
--- a/src/search_dialog.c
+++ b/src/search_dialog.c
@@ -30,7 +30,7 @@
 #include "log.h"
 #include "misc.h"
 #include "picture.h"
-#include "scan.h"
+#include "scan_dialog.h"
 #include "setting.h"
 
 /* TODO: Use G_DEFINE_TYPE_WITH_PRIVATE. */
diff --git a/src/setting.c b/src/setting.c
index a9a5f29..a004491 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -192,9 +192,6 @@ static const tConfigVariable Config_Variables[] =
     {"default_comment",                         CV_TYPE_STRING,  &DEFAULT_COMMENT                        },
     {"crc32_comment",                           CV_TYPE_BOOL,    &SET_CRC32_COMMENT                      },
     {"open_scanner_window_on_startup",          CV_TYPE_BOOL,    &OPEN_SCANNER_WINDOW_ON_STARTUP         },
-    {"set_scanner_window_position",             CV_TYPE_BOOL,    &SET_SCANNER_WINDOW_POSITION            },
-    {"scanner_window_x",                        CV_TYPE_INT,     &SCANNER_WINDOW_X                       },
-    {"scanner_window_y",                        CV_TYPE_INT,     &SCANNER_WINDOW_Y                       },
 
     {"confirm_before_exit",                     CV_TYPE_BOOL,    &CONFIRM_BEFORE_EXIT                    },
     {"confirm_write_tag",                       CV_TYPE_BOOL,    &CONFIRM_WRITE_TAG                      },
@@ -422,7 +419,7 @@ void Init_Config_Variables (void)
     /*
      * Scanner
      */
-    SCANNER_TYPE                              = SCANNER_FILL_TAG;
+    SCANNER_TYPE                              = ET_SCAN_TYPE_FILL_TAG;
     SCAN_MASK_EDITOR_BUTTON                   = 0;
     SCAN_LEGEND_BUTTON                        = 0;
     FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 1;
@@ -435,9 +432,6 @@ void Init_Config_Variables (void)
     DEFAULT_COMMENT                           = g_strdup("Tagged with EasyTAG");
     SET_CRC32_COMMENT                         = 0;
     OPEN_SCANNER_WINDOW_ON_STARTUP            = 0;
-    SET_SCANNER_WINDOW_POSITION               = 1; // Set it to '0' if problem with some Windows Manager
-    SCANNER_WINDOW_X                          = -1;
-    SCANNER_WINDOW_Y                          = -1;
 
     /*
      * Confirmation
@@ -805,12 +799,6 @@ Apply_Changes_Of_Preferences_Window (void)
         // FIX ME : commented as it reloads files...
         //Browser_Tree_Rebuild(NULL);
     }
-
-    if (ScannerWindow)
-    {
-        gtk_window_set_transient_for (GTK_WINDOW (ScannerWindow),
-                                      GTK_WINDOW (MainWindow));
-    }
 }
 
 /*
@@ -829,8 +817,9 @@ Apply_Changes_Of_UI (void)
      * Function also called when destroying the window. */
     et_preferences_dialog_apply_changes (ET_PREFERENCES_DIALOG (et_application_window_get_preferences_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
-    // Configuration of the scanner window (see scan.c) - Function also called when destroying the window
-    ScannerWindow_Apply_Changes();
+    /* Configuration of the scanner window (see scan_dialog.c).
+     * Function also called when destroying the window. */
+    et_scan_dialog_apply_changes (ET_SCAN_DIALOG (et_application_window_get_scan_dialog 
(ET_APPLICATION_WINDOW (MainWindow))));
 
     /* Configuration of the cddb window (see cddb_dialog.c).
      * Function also called when destroying the window. */
diff --git a/src/setting.h b/src/setting.h
index 6aa2b84..7d0e1f3 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -139,9 +139,6 @@ gint    SET_DEFAULT_COMMENT;
 gchar  *DEFAULT_COMMENT;
 gint    SET_CRC32_COMMENT;
 gint    OPEN_SCANNER_WINDOW_ON_STARTUP;
-gint    SET_SCANNER_WINDOW_POSITION;
-gint    SCANNER_WINDOW_X;
-gint    SCANNER_WINDOW_Y;
 
 /* Confirmation */
 gint    CONFIRM_BEFORE_EXIT;


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