[easytag/wip/application-window: 11/70] Store ID3v1 and ID3v2 iconv options in GSettings



commit 6a470c1db6f66dff916a4c7841120f57befb76bb
Author: David King <amigadave amigadave com>
Date:   Fri May 9 18:57:54 2014 +0100

    Store ID3v1 and ID3v2 iconv options in GSettings

 data/org.gnome.EasyTAG.gschema.xml |    4 +-
 src/id3_tag.c                      |   63 ++++++++++++-------
 src/id3v24_tag.c                   |   12 +++-
 src/preferences_dialog.c           |  120 ++++++++++++++++++++++++------------
 src/preferences_dialog.h           |    7 --
 src/setting.c                      |   20 ------
 src/setting.h                      |   14 +++--
 7 files changed, 139 insertions(+), 101 deletions(-)
---
diff --git a/data/org.gnome.EasyTAG.gschema.xml b/data/org.gnome.EasyTAG.gschema.xml
index 3bd184a..2e71dbc 100644
--- a/data/org.gnome.EasyTAG.gschema.xml
+++ b/data/org.gnome.EasyTAG.gschema.xml
@@ -242,13 +242,13 @@
       <description>Choose the character set to be used when writing ID3v1 tags</description>
       <default>'ISO-8859-1'</default>
     </key>
+    -->
 
     <key name="id3v1-encoding-option" enum="org.gnome.EasyTAG.EtTagEncoding">
       <summary>Encoding options when writing ID3v1 tags</summary>
       <description>Additional options to pass to iconv() when converting between encodings when writing 
ID3v1 tags</description>
       <default>'none'</default>
     </key>
-    -->
 
     <key name="id3v2-enabled" type="b">
       <summary>Write ID3v2 tags</summary>
@@ -308,13 +308,13 @@
       <description>Override the typical Unicode character set to be used when writing ID3v2 
tags</description>
       <default>'ISO-8859-1'</default>
     </key>
+    -->
 
     <key name="id3v2-encoding-option" enum="org.gnome.EasyTAG.EtTagEncoding">
       <summary>Encoding options when writing ID3v2 tags</summary>
       <description>Additional options to pass to iconv() when converting between encodings when writing 
ID3v2 tags</description>
       <default>'none'</default>
     </key>
-    -->
 
     <key name="tag-date-autocomplete" type="b">
       <summary>Automatically complete the date</summary>
diff --git a/src/id3_tag.c b/src/id3_tag.c
index 5d1a122..b04df6a 100644
--- a/src/id3_tag.c
+++ b/src/id3_tag.c
@@ -1252,37 +1252,54 @@ void Id3tag_Prepare_ID3v1 (ID3Tag *id3_tag)
  * We use specials functionalities of iconv : //TRANSLIT and //IGNORE (the last
  * one doesn't work on my system) to force conversion to the target encoding.
  */
-gchar *Id3tag_Rules_For_ISO_Fields (const gchar *string, const gchar *from_codeset, const gchar *to_codeset)
+gchar *
+Id3tag_Rules_For_ISO_Fields (const gchar *string,
+                             const gchar *from_codeset,
+                             const gchar *to_codeset)
 {
     gchar *string_converted = NULL;
+    EtTagEncoding iconv_option;
 
     g_return_val_if_fail (string != NULL && from_codeset != NULL
                           && to_codeset != NULL, NULL);
 
-    if (FILE_WRITING_ID3V1_ICONV_OPTIONS_NO)
-    {
-        string_converted = convert_string(string,from_codeset,to_codeset,TRUE);
+    iconv_option = g_settings_get_enum (MainSettings, "id3v1-encoding-option");
 
-    }else if (FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT)
-    {
-        // iconv_open (3):
-        // When the string "//TRANSLIT" is appended to tocode, transliteration
-        // is activated. This means that when a character cannot be represented
-        // in the target character set, it can be approximated through one or
-        // several similarly looking characters.
-        gchar *to_enc = g_strconcat(to_codeset, "//TRANSLIT", NULL);
-        string_converted = convert_string(string,from_codeset,to_enc,TRUE);
-        g_free(to_enc);
-
-    }else if (FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE)
+    switch (iconv_option)
     {
-        // iconv_open (3):
-        // When the string "//IGNORE" is appended to tocode, characters that
-        // cannot be represented in the target character set will be silently
-        // discarded.
-        gchar *to_enc = g_strconcat(to_codeset, "//IGNORE", NULL);
-        string_converted = convert_string(string,from_codeset,to_enc,TRUE);
-        g_free(to_enc);
+        default:
+        case ET_TAG_ENCODING_NONE:
+            string_converted = convert_string (string, from_codeset,
+                                               to_codeset, TRUE);
+            break;
+        case ET_TAG_ENCODING_TRANSLITERATE:
+        {
+            /* iconv_open (3):
+             * When the string "//TRANSLIT" is appended to tocode,
+             * transliteration is activated. This means that when a character
+             * cannot be represented in the target character set, it can be
+             * approximated through one or several similarly looking
+             * characters.
+             */
+            gchar *to_enc = g_strconcat (to_codeset, "//TRANSLIT", NULL);
+            string_converted = convert_string (string, from_codeset, to_enc,
+                                               TRUE);
+            g_free (to_enc);
+            break;
+        }
+        case ET_TAG_ENCODING_IGNORE:
+        {
+            /* iconv_open (3):
+             * When the string "//IGNORE" is appended to tocode, characters
+             * that cannot be represented in the target character set will be
+             * silently discarded.
+             */
+            gchar *to_enc = g_strconcat (to_codeset, "//IGNORE", NULL);
+            string_converted = convert_string (string, from_codeset, to_enc,
+                                               TRUE);
+            g_free (to_enc);
+            break;
+        }
     }
 
     return string_converted;
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index 11e84ad..c30d4fc 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -1241,10 +1241,12 @@ id3taglib_set_field(struct id3_frame *frame,
             /* id3v1 fields converted using its own character set and iconv options */
             if ( id3v1 )
             {
-                if ( !FILE_WRITING_ID3V1_ICONV_OPTIONS_NO )
+                EtTagEncoding iconv_option = g_settings_get_enum (MainSettings,
+                                                                  "id3v1-encoding-option");
+                if (iconv_option != ET_TAG_ENCODING_NONE)
                     encname = g_strconcat(
                         FILE_WRITING_ID3V1_CHARACTER_SET,
-                        FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT ? "//TRANSLIT" : "//IGNORE",
+                        iconv_option == ET_TAG_ENCODING_TRANSLITERATE ? "//TRANSLIT" : "//IGNORE",
                         NULL);
                 else
                     encname = g_strdup(FILE_WRITING_ID3V1_CHARACTER_SET);
@@ -1253,10 +1255,12 @@ id3taglib_set_field(struct id3_frame *frame,
                 /* latin1 fields (such as URL) always converted with ISO-8859-1*/
                 if ((type != ID3_FIELD_TYPE_LATIN1) && (type != ID3_FIELD_TYPE_LATIN1FULL))
                 {
-                    if ( FILE_WRITING_ID3V2_ICONV_OPTIONS_NO == 0)
+                    EtTagEncoding iconv_option = g_settings_get_enum (MainSettings,
+                                                                      "id3v2-encoding-option");
+                    if (iconv_option != ET_TAG_ENCODING_NONE)
                         encname = g_strconcat(
                             FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET,
-                            FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT ? "//TRANSLIT" : "//IGNORE",
+                            iconv_option == ET_TAG_ENCODING_TRANSLITERATE ? "//TRANSLIT" : "//IGNORE",
                             NULL);
                     else
                         encname = g_strdup(FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET);
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
index 3a319de..01f8264 100644
--- a/src/preferences_dialog.c
+++ b/src/preferences_dialog.c
@@ -67,6 +67,12 @@ struct _EtPreferencesDialogPrivate
     GtkWidget *FileWritingId3v2UseCrc32;
     GtkWidget *FileWritingId3v2UseCompression;
     GtkWidget *FileWritingId3v2TextOnlyGenre;
+    GtkWidget *FileWritingId3v2IconvOptionsNo;
+    GtkWidget *FileWritingId3v2IconvOptionsTranslit;
+    GtkWidget *FileWritingId3v2IconvOptionsIgnore;
+    GtkWidget *FileWritingId3v1IconvOptionsNo;
+    GtkWidget *FileWritingId3v1IconvOptionsTranslit;
+    GtkWidget *FileWritingId3v1IconvOptionsIgnore;
 
     GtkWidget *options_notebook;
     gint options_notebook_scanner;
@@ -872,34 +878,52 @@ create_preferences_dialog (EtPreferencesDialog *self)
     gtk_misc_set_alignment (GTK_MISC (priv->LabelAdditionalId3v2IconvOptions),
                             0, 0.5);
 
-    FileWritingId3v2IconvOptionsNo = gtk_radio_button_new_with_label(NULL,
-        _("No"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2IconvOptionsNo, 2, 6, 1,
+    priv->FileWritingId3v2IconvOptionsNo = gtk_radio_button_new_with_label (NULL,
+                                                                            _("No"));
+    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2IconvOptionsNo, 2, 6, 1,
                      1);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsNo),FILE_WRITING_ID3V2_ICONV_OPTIONS_NO);
-    gtk_widget_set_tooltip_text(FileWritingId3v2IconvOptionsNo,_("With this option, when "
+    gtk_widget_set_name (priv->FileWritingId3v2IconvOptionsNo, "none");
+    gtk_widget_set_tooltip_text (priv->FileWritingId3v2IconvOptionsNo, _("With this option, when "
         "a character cannot be represented in the target character set, it isn't changed. "
         "But note that an error message will be displayed for information."));
-    FileWritingId3v2IconvOptionsTranslit = gtk_radio_button_new_with_label(
-        gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileWritingId3v2IconvOptionsNo)),
+    priv->FileWritingId3v2IconvOptionsTranslit = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v2IconvOptionsNo)),
         _("//TRANSLIT"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2IconvOptionsTranslit, 3,
+    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2IconvOptionsTranslit, 3,
                      6, 1, 1);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsTranslit),FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT);
-    gtk_widget_set_tooltip_text(FileWritingId3v2IconvOptionsTranslit,_("With this option, when "
+    gtk_widget_set_name (priv->FileWritingId3v2IconvOptionsTranslit,
+                         "transliterate");
+    gtk_widget_set_tooltip_text (priv->FileWritingId3v2IconvOptionsTranslit, _("With this option, when "
         "a character cannot be represented in the target character set, it can be "
         "approximated through one or several similarly looking characters."));
 
-    FileWritingId3v2IconvOptionsIgnore = gtk_radio_button_new_with_label(
-        gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileWritingId3v2IconvOptionsNo)),
+    priv->FileWritingId3v2IconvOptionsIgnore = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v2IconvOptionsNo)),
         _("//IGNORE"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v2IconvOptionsIgnore, 4,
+    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v2IconvOptionsIgnore, 4,
                      6, 1, 1);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsIgnore),FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE);
-    gtk_widget_set_tooltip_text(FileWritingId3v2IconvOptionsIgnore,_("With this option, when "
+    gtk_widget_set_name (priv->FileWritingId3v2IconvOptionsIgnore, "ignore");
+    gtk_widget_set_tooltip_text (priv->FileWritingId3v2IconvOptionsIgnore, _("With this option, when "
         "a character cannot be represented in the target character set, it will "
         "be silently discarded."));
 
+    g_settings_bind_with_mapping (MainSettings, "id3v2-encoding-option",
+                                  priv->FileWritingId3v2IconvOptionsNo, "active",
+                                  G_SETTINGS_BIND_DEFAULT,
+                                  et_settings_enum_radio_get,
+                                  et_settings_enum_radio_set,
+                                  priv->FileWritingId3v2IconvOptionsNo, NULL);
+    g_settings_bind_with_mapping (MainSettings, "id3v2-encoding-option",
+                                  priv->FileWritingId3v2IconvOptionsTranslit,
+                                  "active", G_SETTINGS_BIND_DEFAULT,
+                                  et_settings_enum_radio_get,
+                                  et_settings_enum_radio_set,
+                                  priv->FileWritingId3v2IconvOptionsTranslit, NULL);
+    g_settings_bind_with_mapping (MainSettings, "id3v2-encoding-option",
+                                  priv->FileWritingId3v2IconvOptionsIgnore, "active",
+                                  G_SETTINGS_BIND_DEFAULT,
+                                  et_settings_enum_radio_get,
+                                  et_settings_enum_radio_set,
+                                  priv->FileWritingId3v2IconvOptionsIgnore, NULL);
+
     // ID3v1 tags
     Frame = gtk_frame_new (_("ID3v1 tags"));
     gtk_box_pack_start(GTK_BOX(id3v1v2hbox),Frame,FALSE,FALSE,2);
@@ -943,34 +967,52 @@ create_preferences_dialog (EtPreferencesDialog *self)
     gtk_misc_set_alignment (GTK_MISC (priv->LabelAdditionalId3v1IconvOptions),
                             0, 0.5);
 
-    FileWritingId3v1IconvOptionsNo = gtk_radio_button_new_with_label(NULL,
-        _("No"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v1IconvOptionsNo, 1, 4, 1,
+    priv->FileWritingId3v1IconvOptionsNo = gtk_radio_button_new_with_label (NULL,
+                                                                            _("No"));
+    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1IconvOptionsNo, 1, 4, 1,
                      1);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsNo),FILE_WRITING_ID3V1_ICONV_OPTIONS_NO);
-    gtk_widget_set_tooltip_text(FileWritingId3v1IconvOptionsNo,_("With this option, when "
+    gtk_widget_set_name (priv->FileWritingId3v1IconvOptionsNo, "none");
+    gtk_widget_set_tooltip_text (priv->FileWritingId3v1IconvOptionsNo, _("With this option, when "
         "a character cannot be represented in the target character set, it isn't changed. "
         "But note that an error message will be displayed for information."));
-    FileWritingId3v1IconvOptionsTranslit = gtk_radio_button_new_with_label(
-        gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileWritingId3v1IconvOptionsNo)),
+    priv->FileWritingId3v1IconvOptionsTranslit = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v1IconvOptionsNo)),
         _("//TRANSLIT"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v1IconvOptionsTranslit, 2,
+    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1IconvOptionsTranslit, 2,
                      4, 1, 1);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsTranslit),FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT);
-    gtk_widget_set_tooltip_text(FileWritingId3v1IconvOptionsTranslit,_("With this option, when "
+    gtk_widget_set_name (priv->FileWritingId3v1IconvOptionsTranslit,
+                         "transliterate");
+    gtk_widget_set_tooltip_text (priv->FileWritingId3v1IconvOptionsTranslit,_("With this option, when "
         "a character cannot be represented in the target character set, it can be "
         "approximated through one or several similarly looking characters."));
 
-    FileWritingId3v1IconvOptionsIgnore = gtk_radio_button_new_with_label(
-        gtk_radio_button_get_group(GTK_RADIO_BUTTON(FileWritingId3v1IconvOptionsNo)),
+    priv->FileWritingId3v1IconvOptionsIgnore = gtk_radio_button_new_with_label (gtk_radio_button_get_group 
(GTK_RADIO_BUTTON (priv->FileWritingId3v1IconvOptionsNo)),
         _("//IGNORE"));
-    gtk_grid_attach (GTK_GRID (Table), FileWritingId3v1IconvOptionsIgnore, 3,
+    gtk_grid_attach (GTK_GRID (Table), priv->FileWritingId3v1IconvOptionsIgnore, 3,
                      4, 1, 1);
-    
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsIgnore),FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE);
-    gtk_widget_set_tooltip_text(FileWritingId3v1IconvOptionsIgnore,_("With this option, when "
+    gtk_widget_set_name (priv->FileWritingId3v1IconvOptionsIgnore, "ignore");
+    gtk_widget_set_tooltip_text (priv->FileWritingId3v1IconvOptionsIgnore, _("With this option, when "
         "a character cannot be represented in the target character set, it will "
         "be silently discarded."));
 
+    g_settings_bind_with_mapping (MainSettings, "id3v1-encoding-option",
+                                  priv->FileWritingId3v1IconvOptionsNo, "active",
+                                  G_SETTINGS_BIND_DEFAULT,
+                                  et_settings_enum_radio_get,
+                                  et_settings_enum_radio_set,
+                                  priv->FileWritingId3v1IconvOptionsNo, NULL);
+    g_settings_bind_with_mapping (MainSettings, "id3v1-encoding-option",
+                                  priv->FileWritingId3v1IconvOptionsTranslit,
+                                  "active", G_SETTINGS_BIND_DEFAULT,
+                                  et_settings_enum_radio_get,
+                                  et_settings_enum_radio_set,
+                                  priv->FileWritingId3v1IconvOptionsTranslit, NULL);
+    g_settings_bind_with_mapping (MainSettings, "id3v1-encoding-option",
+                                  priv->FileWritingId3v1IconvOptionsIgnore, "active",
+                                  G_SETTINGS_BIND_DEFAULT,
+                                  et_settings_enum_radio_get,
+                                  et_settings_enum_radio_set,
+                                  priv->FileWritingId3v1IconvOptionsIgnore, NULL);
+
     /* Character Set for reading tag */
     Frame = gtk_frame_new (_("Character Set for reading ID3 tags"));
     gtk_box_pack_start(GTK_BOX(VBox),Frame,FALSE,FALSE,0);
@@ -1558,9 +1600,9 @@ Change_Id3_Settings_Toggled (GtkWidget *blah, EtPreferencesDialog *self)
         gtk_widget_set_sensitive(priv->FileWritingId3v2UseNoUnicodeCharacterSet, TRUE);
         gtk_widget_set_sensitive(FileWritingId3v2NoUnicodeCharacterSetCombo, !active);
         gtk_widget_set_sensitive (priv->LabelAdditionalId3v2IconvOptions, !active);
-        gtk_widget_set_sensitive(FileWritingId3v2IconvOptionsNo, !active);
-        gtk_widget_set_sensitive(FileWritingId3v2IconvOptionsTranslit, !active);
-        gtk_widget_set_sensitive(FileWritingId3v2IconvOptionsIgnore, !active);
+        gtk_widget_set_sensitive (priv->FileWritingId3v2IconvOptionsNo, !active);
+        gtk_widget_set_sensitive (priv->FileWritingId3v2IconvOptionsTranslit, !active);
+        gtk_widget_set_sensitive (priv->FileWritingId3v2IconvOptionsIgnore, !active);
         gtk_widget_set_sensitive (priv->FileWritingId3v2UseCrc32, TRUE);
         gtk_widget_set_sensitive (priv->FileWritingId3v2UseCompression, TRUE);
         gtk_widget_set_sensitive (priv->FileWritingId3v2TextOnlyGenre, TRUE);
@@ -1578,9 +1620,9 @@ Change_Id3_Settings_Toggled (GtkWidget *blah, EtPreferencesDialog *self)
         gtk_widget_set_sensitive(FileWritingId3v2UnicodeCharacterSetCombo, FALSE);
         gtk_widget_set_sensitive(FileWritingId3v2NoUnicodeCharacterSetCombo, FALSE);
         gtk_widget_set_sensitive (priv->LabelAdditionalId3v2IconvOptions, FALSE);
-        gtk_widget_set_sensitive(FileWritingId3v2IconvOptionsNo, FALSE);
-        gtk_widget_set_sensitive(FileWritingId3v2IconvOptionsTranslit, FALSE);
-        gtk_widget_set_sensitive(FileWritingId3v2IconvOptionsIgnore, FALSE);
+        gtk_widget_set_sensitive (priv->FileWritingId3v2IconvOptionsNo, FALSE);
+        gtk_widget_set_sensitive (priv->FileWritingId3v2IconvOptionsTranslit, FALSE);
+        gtk_widget_set_sensitive (priv->FileWritingId3v2IconvOptionsIgnore, FALSE);
         gtk_widget_set_sensitive (priv->FileWritingId3v2UseCrc32, FALSE);
         gtk_widget_set_sensitive (priv->FileWritingId3v2UseCompression, FALSE);
         gtk_widget_set_sensitive (priv->FileWritingId3v2TextOnlyGenre, FALSE);
@@ -1592,9 +1634,9 @@ Change_Id3_Settings_Toggled (GtkWidget *blah, EtPreferencesDialog *self)
     gtk_widget_set_sensitive (priv->LabelId3v1Charset, active);
     gtk_widget_set_sensitive(FileWritingId3v1CharacterSetCombo, active);
     gtk_widget_set_sensitive (priv->LabelAdditionalId3v1IconvOptions, active);
-    gtk_widget_set_sensitive(FileWritingId3v1IconvOptionsNo, active);
-    gtk_widget_set_sensitive(FileWritingId3v1IconvOptionsTranslit, active);
-    gtk_widget_set_sensitive(FileWritingId3v1IconvOptionsIgnore, active);
+    gtk_widget_set_sensitive (priv->FileWritingId3v1IconvOptionsNo, active);
+    gtk_widget_set_sensitive (priv->FileWritingId3v1IconvOptionsTranslit, active);
+    gtk_widget_set_sensitive (priv->FileWritingId3v1IconvOptionsIgnore, active);
 }
 
 /* Callback from et_preferences_dialog_on_response. */
diff --git a/src/preferences_dialog.h b/src/preferences_dialog.h
index 8631258..1169700 100644
--- a/src/preferences_dialog.h
+++ b/src/preferences_dialog.h
@@ -75,13 +75,6 @@ GtkWidget *FileWritingId3v2NoUnicodeCharacterSetCombo;
 GtkWidget *FileWritingId3v1CharacterSetCombo;
 GtkWidget *FileReadingId3v1v2CharacterSetCombo;
 
-GtkWidget *FileWritingId3v2IconvOptionsNo;
-GtkWidget *FileWritingId3v2IconvOptionsTranslit;
-GtkWidget *FileWritingId3v2IconvOptionsIgnore;
-GtkWidget *FileWritingId3v1IconvOptionsNo;
-GtkWidget *FileWritingId3v1IconvOptionsTranslit;
-GtkWidget *FileWritingId3v1IconvOptionsIgnore;
-
 GtkWidget *pad_disc_number;
 GtkWidget *pad_disc_number_spinbutton;
 
diff --git a/src/setting.c b/src/setting.c
index 49d9037..a04257a 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -123,13 +123,7 @@ static const tConfigVariable Config_Variables[] =
     {"file_writing_id3v2_version_4",                   CV_TYPE_BOOL,  &FILE_WRITING_ID3V2_VERSION_4   },
     {"file_writing_id3v2_unicode_character_set",       
CV_TYPE_STRING,&FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET},
     {"file_writing_id3v2_no_unicode_character_set",    
CV_TYPE_STRING,&FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET},
-    {"file_writing_id3v2_iconv_options_no",            CV_TYPE_BOOL,  &FILE_WRITING_ID3V2_ICONV_OPTIONS_NO},
-    {"file_writing_id3v2_iconv_options_translit",      CV_TYPE_BOOL,  
&FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT},
-    {"file_writing_id3v2_iconv_options_ignore",        CV_TYPE_BOOL,  
&FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE},
     {"file_writing_id3v1_character_set",               CV_TYPE_STRING,&FILE_WRITING_ID3V1_CHARACTER_SET},
-    {"file_writing_id3v1_iconv_options_no",            CV_TYPE_BOOL,  &FILE_WRITING_ID3V1_ICONV_OPTIONS_NO},
-    {"file_writing_id3v1_iconv_options_translit",      CV_TYPE_BOOL,  
&FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT},
-    {"file_writing_id3v1_iconv_options_ignore",        CV_TYPE_BOOL,  
&FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE},
 
     {"audio_file_player",                       CV_TYPE_STRING,&AUDIO_FILE_PLAYER                        },
 
@@ -252,13 +246,7 @@ void Init_Config_Variables (void)
     FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET        = g_strdup("UTF-8");
 #endif /* !G_OS_WIN32 */
     FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET     = g_strdup("ISO-8859-1");
-    FILE_WRITING_ID3V2_ICONV_OPTIONS_NO             = 1;
-    FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT       = 0;
-    FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE         = 0;
     FILE_WRITING_ID3V1_CHARACTER_SET                = g_strdup("ISO-8859-1");
-    FILE_WRITING_ID3V1_ICONV_OPTIONS_NO             = 0;
-    FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT       = 1;
-    FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE         = 0;
 
     /*
      * Scanner
@@ -390,18 +378,10 @@ Apply_Changes_Of_Preferences_Window (void)
         FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET  = Charset_Get_Name_From_Title(temp);
         g_free(temp);
 
-        FILE_WRITING_ID3V2_ICONV_OPTIONS_NO          = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsNo));
-        FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsTranslit));
-        FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v2IconvOptionsIgnore));
-
         temp = Get_Active_Combo_Box_Item(GTK_COMBO_BOX(FileWritingId3v1CharacterSetCombo));
         FILE_WRITING_ID3V1_CHARACTER_SET             = Charset_Get_Name_From_Title(temp);
         g_free(temp);
 
-        FILE_WRITING_ID3V1_ICONV_OPTIONS_NO          = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsNo));
-        FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT    = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsTranslit));
-        FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE      = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FileWritingId3v1IconvOptionsIgnore));
-
         /* Scanner */
         // Fill Tag Scanner
         FTS_CONVERT_UNDERSCORE_AND_P20_INTO_SPACE = 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(FTSConvertUnderscoreAndP20IntoSpace));
diff --git a/src/setting.h b/src/setting.h
index 40964ba..c0d7869 100644
--- a/src/setting.h
+++ b/src/setting.h
@@ -115,6 +115,14 @@ typedef enum
     ET_SORT_MODE_DESCENDING_FILE_SAMPLERATE
 } EtSortMode;
 
+/* Additional options to be passed to iconv(). */
+typedef enum
+{
+    ET_TAG_ENCODING_NONE,
+    ET_TAG_ENCODING_TRANSLITERATE,
+    ET_TAG_ENCODING_IGNORE
+} EtTagEncoding;
+
 /*
  * Config variables
  */
@@ -140,14 +148,8 @@ gchar  *FILE_READING_ID3V1V2_CHARACTER_SET;
 
 gchar  *FILE_WRITING_ID3V2_UNICODE_CHARACTER_SET;
 gchar  *FILE_WRITING_ID3V2_NO_UNICODE_CHARACTER_SET;
-gint    FILE_WRITING_ID3V2_ICONV_OPTIONS_NO;
-gint    FILE_WRITING_ID3V2_ICONV_OPTIONS_TRANSLIT;
-gint    FILE_WRITING_ID3V2_ICONV_OPTIONS_IGNORE;
 
 gchar  *FILE_WRITING_ID3V1_CHARACTER_SET;
-gint    FILE_WRITING_ID3V1_ICONV_OPTIONS_NO;
-gint    FILE_WRITING_ID3V1_ICONV_OPTIONS_TRANSLIT;
-gint    FILE_WRITING_ID3V1_ICONV_OPTIONS_IGNORE;
 
 gint PAD_DISC_NUMBER;
 gint PAD_DISC_NUMBER_DIGITS;


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